mix-test.watch icon indicating copy to clipboard operation
mix-test.watch copied to clipboard

`test.watch` for one test file runs all tests instead

Open Ziinc opened this issue 5 years ago • 5 comments

Following the instructions in the README, I tried to run a single test file like so, but it does not behave as expected:

Expected (same output as mix test test/path_to_test_file.exs) :

C:\path_to_project\server (develop -> origin)
λ mix test.watch test/path_to_test_file.exs

Finished in 0.2 seconds
3 tests, 0 failures

Randomized with seed 726000

Actual:

C:\path_to_project\server (develop -> origin)
λ mix test.watch test/path_to_test_file.exs

Running tests...

...........**................................................................................................................................................................*........................

Finished in 2.3 seconds
198 tests, 0 failures, 3 skipped

Randomized with seed 484000

I am on windows 10, mix deps is as so:

...
{:mix_test_watch, "~> 0.8", only: :dev, runtime: false},
...

Ziinc avatar Apr 28 '19 11:04 Ziinc

Hi, thanks for the report.

I'm unable to reproduce this on my Linux machine. Could you provide a minimal reproduction of the problem and upload the project to GitHub? It would help determine if the problem is windows or something else.

Thank you.

lpil avatar Apr 28 '19 13:04 lpil

I've reproduced it here: https://github.com/Ziinc/mix-test-watch-repro

Thanks for the super prompt reply!

Ziinc avatar Apr 28 '19 16:04 Ziinc

Seems like the command variable containing build tasks cmds isn't passed to the windows cmd command

https://github.com/lpil/mix-test.watch/blob/6dc3973076e82a2735d084387c351d25b098a6cb/lib/mix_test_watch/port_runner/port_runner.ex#L16

as compared to the linux version:

https://github.com/lpil/mix-test.watch/blob/6dc3973076e82a2735d084387c351d25b098a6cb/lib/mix_test_watch/port_runner/port_runner.ex#L19

Ziinc avatar Apr 28 '19 16:04 Ziinc

Great catch!! Would you like to make a PR fixing this?

lpil avatar Apr 28 '19 16:04 lpil

Made: https://github.com/lpil/mix-test.watch/pull/104

Isn't completely fixed though, there's a weird double quote issue that I explained in the PR.

Ziinc avatar Apr 28 '19 17:04 Ziinc