-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
14 changed files
with
489 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
elixir 1.17.1-otp-27 | ||
erlang 27.0 | ||
elixir 1.17.2-otp-26 | ||
erlang 26.2.5.2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
defmodule Mix.Tasks.Mneme.Watch do | ||
@shortdoc "Run tests when files change" | ||
@moduledoc """ | ||
Runs the tests for a project when source files change. | ||
This task is similar to [`mix test.watch`](https://hex.pm/packages/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: | ||
```sh | ||
# 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 the `mix test` documentation for more information. | ||
""" | ||
|
||
use Mix.Task | ||
|
||
@doc false | ||
@impl Mix.Task | ||
@spec run([String.t()]) :: no_return() | ||
def run(args) do | ||
Mix.env(:test) | ||
|
||
children = [ | ||
{Mneme.Watch.TestRunner, cli_args: args} | ||
] | ||
|
||
Supervisor.start_link(children, strategy: :one_for_one) | ||
|
||
:timer.sleep(:infinity) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.