View Source mix mneme.watch (Mneme v0.9.0)

Runs the tests for a project when source files change.

This task is similar to mix test.watch, but updated to work with Mneme:

  • interrupts Mneme prompts, saving already-accepted changes
  • doesn't re-trigger when test files are updated by Mneme

Setup

To ensure mix mneme.watch runs in the test environment, add a :preferred_cli_env entry in mix.exs:

def project do
  [
    ...
    preferred_cli_env: [
      "mneme.watch": :test
    ],
    ...
  ]
end

Command line options

This task runs mix test under the hood and passes all CLI arguments to it directly. For instance:

# only run tests tagged with `some_tag: true`
$ mix mneme.watch --only some_tag

# only run tests from one file
$ mix mneme.watch test/my_app/my_test.exs

See mix test documentation for more information on CLI arguments.