Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paulfioravanti/0837aa7320ab7be3169900592f89d8c5 to your computer and use it in GitHub Desktop.
Save paulfioravanti/0837aa7320ab7be3169900592f89d8c5 to your computer and use it in GitHub Desktop.
Elm test runner that covers elm-verify-examples and elm-test tests

Test Runner for both elm-verify-examples and elm-test

I wanted to have a process that would run elm-verify-examples and then elm-test upon any change in an Elm project's src or tests directories.

A command like elm-verify-examples --elm-test-args="--watch" didn't work for me (it ran elm-verify-examples the first time, but only elm-test on subsequent times, so instead I used just and watchexec to accomplish this:

Install just and watchexec

brew install just watchexec

Create a Justfile at the root of your Elm project

Justfile

elm-verify-examples:
  elm-verify-examples

elm-test: elm-verify-examples
  elm-test

Run the watch command

watchexec -w src -w tests just elm-test

This will:

  • Watch the src and tests files for any changes
  • When changes are detected, it will run the elm-test command in the Justfile, which will run elm-verify-examples first.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment