diff --git a/README.md b/README.md index dd947b3..3cec77b 100644 --- a/README.md +++ b/README.md @@ -45,6 +45,8 @@ Please keep the following in mind: - The recommended workflow when working on an exercise is to first create the implementation and test files, `ExerciseModuleName.elm` and `tests/Tests.elm`. You'll likely want to copy one of the existing exercise directories as a quick start. - Test the new exercise directly by running `npm test` from the exercise directory. + - Automatically run tests again when you save changes by running `npm run watch` from the exercise directory. + - Once the implementation of the exercise is complete, rename `ExerciseModuleName.elm` to `ExerciseModuleName.example.elm` and create the template `ExerciseModuleName.elm`. - Make sure everything is good to go by running all tests with `bin/build.sh`. diff --git a/docs/EXERCISE_README_INSERT.md b/docs/EXERCISE_README_INSERT.md index e15c29a..52859f0 100644 --- a/docs/EXERCISE_README_INSERT.md +++ b/docs/EXERCISE_README_INSERT.md @@ -18,5 +18,11 @@ Execute the tests with: $ npm test ``` +Automatically run tests again when you save changes: + +```bash +$ npm run watch +``` + As you work your way through the test suite, be sure to remove the `skip <|` calls from each test until you get them all passing! diff --git a/docs/TESTS.md b/docs/TESTS.md index 137d327..fd93a46 100644 --- a/docs/TESTS.md +++ b/docs/TESTS.md @@ -8,6 +8,14 @@ $ npm test ## Hints and tips +### Watch for changes + +Automatically run tests again when you save changes: + +```bash +$ npm run watch +``` + ### Coding the exercise The README.md for each exercise gives a general description, but the Elm test program will be very specific. Open the test program and give it a quick look - if it seems like cheating, do it anyway. Look for helpful comments, test data, and just the names of the test functions. Try running the test command before you have written anything and see if the error messages give you an idea of where to start. diff --git a/exercises/accumulate/package.json b/exercises/accumulate/package.json index c469874..31d6fb3 100644 --- a/exercises/accumulate/package.json +++ b/exercises/accumulate/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/allergies/package.json b/exercises/allergies/package.json index c469874..31d6fb3 100644 --- a/exercises/allergies/package.json +++ b/exercises/allergies/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/anagram/package.json b/exercises/anagram/package.json index c469874..31d6fb3 100644 --- a/exercises/anagram/package.json +++ b/exercises/anagram/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/atbash-cipher/package.json b/exercises/atbash-cipher/package.json index c469874..31d6fb3 100644 --- a/exercises/atbash-cipher/package.json +++ b/exercises/atbash-cipher/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/bob/package.json b/exercises/bob/package.json index c469874..31d6fb3 100644 --- a/exercises/bob/package.json +++ b/exercises/bob/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/difference-of-squares/package.json b/exercises/difference-of-squares/package.json index c469874..31d6fb3 100644 --- a/exercises/difference-of-squares/package.json +++ b/exercises/difference-of-squares/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/gigasecond/package.json b/exercises/gigasecond/package.json index c469874..31d6fb3 100644 --- a/exercises/gigasecond/package.json +++ b/exercises/gigasecond/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/grade-school/package.json b/exercises/grade-school/package.json index c469874..31d6fb3 100644 --- a/exercises/grade-school/package.json +++ b/exercises/grade-school/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/grains/package.json b/exercises/grains/package.json index c469874..31d6fb3 100644 --- a/exercises/grains/package.json +++ b/exercises/grains/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/hamming/package.json b/exercises/hamming/package.json index c469874..31d6fb3 100644 --- a/exercises/hamming/package.json +++ b/exercises/hamming/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/hello-world/package.json b/exercises/hello-world/package.json index c469874..31d6fb3 100644 --- a/exercises/hello-world/package.json +++ b/exercises/hello-world/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/largest-series-product/package.json b/exercises/largest-series-product/package.json index c469874..31d6fb3 100644 --- a/exercises/largest-series-product/package.json +++ b/exercises/largest-series-product/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/leap/package.json b/exercises/leap/package.json index c469874..31d6fb3 100644 --- a/exercises/leap/package.json +++ b/exercises/leap/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/list-ops/package.json b/exercises/list-ops/package.json index c469874..31d6fb3 100644 --- a/exercises/list-ops/package.json +++ b/exercises/list-ops/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/nucleotide-count/package.json b/exercises/nucleotide-count/package.json index c469874..31d6fb3 100644 --- a/exercises/nucleotide-count/package.json +++ b/exercises/nucleotide-count/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/pangram/package.json b/exercises/pangram/package.json index c469874..31d6fb3 100644 --- a/exercises/pangram/package.json +++ b/exercises/pangram/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/phone-number/package.json b/exercises/phone-number/package.json index c469874..31d6fb3 100644 --- a/exercises/phone-number/package.json +++ b/exercises/phone-number/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/raindrops/package.json b/exercises/raindrops/package.json index c469874..31d6fb3 100644 --- a/exercises/raindrops/package.json +++ b/exercises/raindrops/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/rna-transcription/package.json b/exercises/rna-transcription/package.json index c469874..31d6fb3 100644 --- a/exercises/rna-transcription/package.json +++ b/exercises/rna-transcription/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/robot-simulator/package.json b/exercises/robot-simulator/package.json index c469874..31d6fb3 100644 --- a/exercises/robot-simulator/package.json +++ b/exercises/robot-simulator/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/roman-numerals/package.json b/exercises/roman-numerals/package.json index c469874..31d6fb3 100644 --- a/exercises/roman-numerals/package.json +++ b/exercises/roman-numerals/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/run-length-encoding/package.json b/exercises/run-length-encoding/package.json index c469874..31d6fb3 100644 --- a/exercises/run-length-encoding/package.json +++ b/exercises/run-length-encoding/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/say/package.json b/exercises/say/package.json index c469874..31d6fb3 100644 --- a/exercises/say/package.json +++ b/exercises/say/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/scrabble-score/package.json b/exercises/scrabble-score/package.json index c469874..31d6fb3 100644 --- a/exercises/scrabble-score/package.json +++ b/exercises/scrabble-score/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/series/package.json b/exercises/series/package.json index c469874..31d6fb3 100644 --- a/exercises/series/package.json +++ b/exercises/series/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/space-age/package.json b/exercises/space-age/package.json index c469874..31d6fb3 100644 --- a/exercises/space-age/package.json +++ b/exercises/space-age/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/strain/package.json b/exercises/strain/package.json index c469874..31d6fb3 100644 --- a/exercises/strain/package.json +++ b/exercises/strain/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/sublist/package.json b/exercises/sublist/package.json index c469874..31d6fb3 100644 --- a/exercises/sublist/package.json +++ b/exercises/sublist/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/sum-of-multiples/package.json b/exercises/sum-of-multiples/package.json index c469874..31d6fb3 100644 --- a/exercises/sum-of-multiples/package.json +++ b/exercises/sum-of-multiples/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/triangle/package.json b/exercises/triangle/package.json index c469874..31d6fb3 100644 --- a/exercises/triangle/package.json +++ b/exercises/triangle/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": { diff --git a/exercises/triangle/tests/Tests.elm b/exercises/triangle/tests/Tests.elm index 5b0746d..27707e5 100644 --- a/exercises/triangle/tests/Tests.elm +++ b/exercises/triangle/tests/Tests.elm @@ -2,13 +2,15 @@ module Tests exposing (..) import Test exposing (..) import Expect -import Triangle exposing (triangleKind, Triangle(..)) +import Triangle exposing (triangleKind, Triangle(..), version) tests : Test tests = describe "triangleKind" - [ test "equilateral triangles have equal sides" <| + [ test "the solution is for the correct version of the test" <| + \() -> Expect.equal 2 version + , test "equilateral triangles have equal sides" <| \() -> Expect.equal (Ok Equilateral) (triangleKind 2 2 2) , skip <| test "larger equilateral triangles also have equal sides" <| diff --git a/exercises/word-count/package.json b/exercises/word-count/package.json index c469874..31d6fb3 100644 --- a/exercises/word-count/package.json +++ b/exercises/word-count/package.json @@ -4,6 +4,7 @@ "license": "MIT", "scripts": { "postinstall": "elm-package install -y", + "watch": "elm-test --watch", "test": "elm-test" }, "dependencies": {