diff --git a/elm.json b/elm.json index 2c17f9da..7bd9c506 100644 --- a/elm.json +++ b/elm.json @@ -18,7 +18,7 @@ "elm/core": "1.0.2 <= v < 2.0.0", "elm/json": "1.1.3 <= v < 2.0.0", "elm/project-metadata-utils": "1.0.0 <= v < 2.0.0", - "elm-explorations/test": "1.2.2 <= v < 2.0.0", + "elm-explorations/test": "2.0.1 <= v < 3.0.0", "stil4m/elm-syntax": "7.2.7 <= v < 8.0.0" }, "test-dependencies": { diff --git a/package-lock.json b/package-lock.json index 8b86c670..e41e5f77 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "hasInstallScript": true, "dependencies": { "elm-review": "^2.7.3", - "elm-test": "^0.19.1-revision6", + "elm-test": "^0.19.1-revision10", "elm-tooling": "^1.7.0" }, "devDependencies": { @@ -369,11 +369,11 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==", + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==", "engines": { - "node": ">= 10" + "node": "^12.20.0 || >=14" } }, "node_modules/compress-brotli": { @@ -510,28 +510,69 @@ "url": "https://github.com/sponsors/jfmengels" } }, + "node_modules/elm-solve-deps-wasm": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elm-solve-deps-wasm/-/elm-solve-deps-wasm-1.0.1.tgz", + "integrity": "sha512-A05XKZKhzM8vWTo8KvNR4g1ICt9iMPOAMfo79OK25c+tQaLSfQ8iMYvW6XgSEd+SgRfM5VSKX4hKEiH6iTiWsg==" + }, "node_modules/elm-test": { - "version": "0.19.1-revision7", - "resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision7.tgz", - "integrity": "sha512-sd3nCQMeYMaY84Sz41bVJ30ZvQN1/4ZcD8uYMOuUbM39FDh58NY9/AcImVJ7Z+gjCFdcSU6VscZzhUoPW8jp6Q==", + "version": "0.19.1-revision10", + "resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision10.tgz", + "integrity": "sha512-33jXpA15alVcYjX+UJOkiOmQIQxjd3c0eeg3960VyhEf8tG8O4g4B5ipMmu6KAllncrSxSQrYzKJnNJM/8ZiCg==", "dependencies": { - "chalk": "^4.1.0", - "chokidar": "^3.5.1", - "commander": "^7.1.0", + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "commander": "^9.3.0", "cross-spawn": "^7.0.3", - "elm-tooling": "^1.2.0", - "glob": "^7.1.6", - "graceful-fs": "^4.2.4", - "rimraf": "^3.0.2", + "elm-solve-deps-wasm": "^1.0.1", + "glob": "^8.0.3", + "graceful-fs": "^4.2.10", "split": "^1.0.1", "which": "^2.0.2", - "xmlbuilder": "^15.1.0" + "xmlbuilder": "^15.1.1" }, "bin": { "elm-test": "bin/elm-test" }, "engines": { - "node": ">=10.13.0" + "node": ">=12.20.0" + } + }, + "node_modules/elm-test/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/elm-test/node_modules/glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/elm-test/node_modules/minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" } }, "node_modules/elm-tooling": { @@ -813,9 +854,9 @@ } }, "node_modules/graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "node_modules/has": { "version": "1.0.3", @@ -1830,20 +1871,6 @@ "node": ">=8" } }, - "node_modules/rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -2124,7 +2151,7 @@ "node_modules/through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "node_modules/to-regex-range": { "version": "5.0.1", @@ -2482,9 +2509,9 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "commander": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-7.2.0.tgz", - "integrity": "sha512-QrWXB+ZQSVPmIWIhtEO9H+gwHaMGYiF5ChvoJ+K9ZGHG/sVsa6yiesAD1GC/x46sET00Xlwo1u49RVVVzvcSkw==" + "version": "9.4.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-9.4.1.tgz", + "integrity": "sha512-5EEkTNyHNGFPD2H+c/dXXfQZYa/scCKasxWcXJaWnNJ99pnQN9Vnmqow+p+PlFPE63Q6mThaZws1T+HxfpgtPw==" }, "compress-brotli": { "version": "1.3.8", @@ -2581,22 +2608,56 @@ "wrap-ansi": "^6.2.0" } }, + "elm-solve-deps-wasm": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/elm-solve-deps-wasm/-/elm-solve-deps-wasm-1.0.1.tgz", + "integrity": "sha512-A05XKZKhzM8vWTo8KvNR4g1ICt9iMPOAMfo79OK25c+tQaLSfQ8iMYvW6XgSEd+SgRfM5VSKX4hKEiH6iTiWsg==" + }, "elm-test": { - "version": "0.19.1-revision7", - "resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision7.tgz", - "integrity": "sha512-sd3nCQMeYMaY84Sz41bVJ30ZvQN1/4ZcD8uYMOuUbM39FDh58NY9/AcImVJ7Z+gjCFdcSU6VscZzhUoPW8jp6Q==", + "version": "0.19.1-revision10", + "resolved": "https://registry.npmjs.org/elm-test/-/elm-test-0.19.1-revision10.tgz", + "integrity": "sha512-33jXpA15alVcYjX+UJOkiOmQIQxjd3c0eeg3960VyhEf8tG8O4g4B5ipMmu6KAllncrSxSQrYzKJnNJM/8ZiCg==", "requires": { - "chalk": "^4.1.0", - "chokidar": "^3.5.1", - "commander": "^7.1.0", + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "commander": "^9.3.0", "cross-spawn": "^7.0.3", - "elm-tooling": "^1.2.0", - "glob": "^7.1.6", - "graceful-fs": "^4.2.4", - "rimraf": "^3.0.2", + "elm-solve-deps-wasm": "^1.0.1", + "glob": "^8.0.3", + "graceful-fs": "^4.2.10", "split": "^1.0.1", "which": "^2.0.2", - "xmlbuilder": "^15.1.0" + "xmlbuilder": "^15.1.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + } + }, + "glob": { + "version": "8.0.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-8.0.3.tgz", + "integrity": "sha512-ull455NHSHI/Y1FqGaaYFaLGkNMMJbavMrEGFXG/PGrg6y7sutWHUHrz6gy6WEBH6akM1M414dWKCNs+IhKdiQ==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^5.0.1", + "once": "^1.3.0" + } + }, + "minimatch": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-5.1.0.tgz", + "integrity": "sha512-9TPBGGak4nHfGZsPBohm9AWg6NoT7QTCehS3BIJABslyZbzxfV78QM2Y6+i741OPZIafFAaiiEMh5OyIrJPgtg==", + "requires": { + "brace-expansion": "^2.0.1" + } + } } }, "elm-tooling": { @@ -2808,9 +2869,9 @@ } }, "graceful-fs": { - "version": "4.2.9", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.9.tgz", - "integrity": "sha512-NtNxqUcXgpW2iMrfqSfR73Glt39K+BLwWsPs94yR63v45T0Wbej7eRmL5cWfwEgqXnmjQp3zaJTshdRW/qC2ZQ==" + "version": "4.2.10", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.10.tgz", + "integrity": "sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA==" }, "has": { "version": "1.0.3", @@ -3524,14 +3585,6 @@ "signal-exit": "^3.0.2" } }, - "rimraf": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", - "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", - "requires": { - "glob": "^7.1.3" - } - }, "safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -3740,7 +3793,7 @@ "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=" + "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==" }, "to-regex-range": { "version": "5.0.1", diff --git a/package.json b/package.json index 63982f7b..47ca2cc7 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ }, "dependencies": { "elm-review": "^2.7.3", - "elm-test": "^0.19.1-revision6", + "elm-test": "^0.19.1-revision10", "elm-tooling": "^1.7.0" }, "devDependencies": { diff --git a/src/Review/Test.elm b/src/Review/Test.elm index 800cc090..19ada9f5 100644 --- a/src/Review/Test.elm +++ b/src/Review/Test.elm @@ -1153,7 +1153,8 @@ checkIfLocationIsAmbiguousInSourceCode sourceCode error_ under = String.indexes under sourceCode in hasOneElement occurrencesInSourceCode - |> Expect.true (FailureMessage.locationIsAmbiguousInSourceCode sourceCode error_ under occurrencesInSourceCode) + |> Expect.equal True + |> Expect.onFail (FailureMessage.locationIsAmbiguousInSourceCode sourceCode error_ under occurrencesInSourceCode) @@ -1375,8 +1376,9 @@ checkErrorMatch : CodeInspector -> ExpectedError -> ReviewError -> (() -> Expect checkErrorMatch codeInspector ((ExpectedError expectedError_) as expectedError) error_ = Expect.all [ \() -> - (expectedError_.message == Rule.errorMessage error_) - |> Expect.true + Rule.errorMessage error_ + |> Expect.equal expectedError_.message + |> Expect.onFail (FailureMessage.messageMismatch (extractExpectedErrorData expectedError) error_ @@ -1410,8 +1412,9 @@ checkMessageAppearsUnder codeInspector error_ (ExpectedError expectedError) = _ -> Expect.pass , \() -> - (codeAtLocation == under) - |> Expect.true (FailureMessage.underMismatch error_ { under = under, codeAtLocation = codeAtLocation }) + codeAtLocation + |> Expect.equal under + |> Expect.onFail (FailureMessage.underMismatch error_ { under = under, codeAtLocation = codeAtLocation }) , \() -> codeInspector.checkIfLocationIsAmbiguous error_ under ] @@ -1419,11 +1422,13 @@ checkMessageAppearsUnder codeInspector error_ (ExpectedError expectedError) = UnderExactly under range -> Expect.all [ \() -> - (codeAtLocation == under) - |> Expect.true (FailureMessage.underMismatch error_ { under = under, codeAtLocation = codeAtLocation }) + codeAtLocation + |> Expect.equal under + |> Expect.onFail (FailureMessage.underMismatch error_ { under = under, codeAtLocation = codeAtLocation }) , \() -> - (Rule.errorRange error_ == range) - |> Expect.true (FailureMessage.wrongLocation error_ range under) + Rule.errorRange error_ + |> Expect.equal range + |> Expect.onFail (FailureMessage.wrongLocation error_ range under) ] Nothing -> @@ -1436,11 +1441,13 @@ checkDetailsAreCorrect : ReviewError -> ExpectedError -> (() -> Expectation) checkDetailsAreCorrect error_ (ExpectedError expectedError) = Expect.all [ \() -> - (not <| List.isEmpty <| Rule.errorDetails error_) - |> Expect.true (FailureMessage.emptyDetails (Rule.errorMessage error_)) + (List.isEmpty <| Rule.errorDetails error_) + |> Expect.equal False + |> Expect.onFail (FailureMessage.emptyDetails (Rule.errorMessage error_)) , \() -> - (Rule.errorDetails error_ == expectedError.details) - |> Expect.true (FailureMessage.unexpectedDetails expectedError.details error_) + Rule.errorDetails error_ + |> Expect.equal expectedError.details + |> Expect.onFail (FailureMessage.unexpectedDetails expectedError.details error_) ] diff --git a/tests/Review/Test/FailureMessageTest.elm b/tests/Review/Test/FailureMessageTest.elm index 735f6d62..88e6ef82 100644 --- a/tests/Review/Test/FailureMessageTest.elm +++ b/tests/Review/Test/FailureMessageTest.elm @@ -51,8 +51,9 @@ expectMessageEqual expectedMessage = (String.lines receivedMessage |> List.map (\line () -> - (String.length line <= 76) - |> Expect.true ("Message has line longer than 76 characters:\n\n" ++ line) + String.length line + |> Expect.atMost 76 + |> Expect.onFail ("Message has line longer than 76 characters:\n\n" ++ line) ) ) ()