Code Monkey home page Code Monkey logo

mix-test.watch's People

Contributors

aeons avatar behe avatar cohen-carlisle avatar daveshah avatar hassan avatar iboss-ptk avatar illiatdesdindes avatar j8th avatar johnhamelink avatar kabturek avatar kianmeng avatar lpil avatar maartenvanvliet avatar mikowitz avatar mnishiguchi avatar msoedov avatar optikfluffel avatar outsmartin avatar papipo avatar periclesd avatar pinfieldharm avatar rjdellecese avatar rrrene avatar rustamtolipov avatar samaaron avatar smeevil avatar steffkes avatar thefirstavenger avatar unclesnottie avatar zeroasterisk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mix-test.watch's Issues

Watch any kind of task

It would be useful to be able to automatically update docs and/or dialyzer in addition to tests.

A suitable api would be mix watch <taskname>. Then we would be able to run mix watch docs or mix watch dialyzer.

It would also be called to be able to run multiple tasks as the files change (e.g test, dialyzer). I have no idea what a suitable command line api would be. Perhaps the alternative for this would be for the programmer to just define a new task that runs to other tasks.

Support @external_resource

Elixir provides a way to notify the compiler of an external file that is required for compilation. This file might be a resource that is used to generate code. mix compile knows it needs to recompile a module if the external resource changes.

mix test.watch does not kick off test runs when an external resource changes. It would be externally helpful if it did run when an external resource changes.

Error running watch with bcrypt usage

The first run when using mix test.watch is successful, but after a file change, there is an error when bcrypt is called (from Comeonin) as the seeds are run (which happens before our test run). The error describes an option to upgrade the bcrypt_elixir version, which has already been upgraded, and also which seems to be an odd error given that the tests do run successfully the first time around.

{"time":"2018-07-20 15:14:57.138","pid":"#PID<0.32.0>","msg":"Process #PID<0.825.0> raised an exception\n** (RuntimeError) An error occurred when loading Bcrypt.\nMake sure you have a C compiler and Erlang 20 installed.\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\nuse version 0.12 of bcrypt_elixir.\nSee the Comeonin wiki for more information.\n\n    (bcrypt_elixir) lib/bcrypt/base.ex:17: Bcrypt.Base.init/0\n    (kernel) code_server.erl:1340: anonymous fn/1 in :code_server.handle_on_load/5","level":"error","error_logger":"format"}
** (UndefinedFunctionError) function Bcrypt.Base.gensalt_nif/3 is undefined (module Bcrypt.Base is not available)
    (bcrypt_elixir) Bcrypt.Base.gensalt_nif([60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98)
    (bcrypt_elixir) lib/bcrypt.ex:52: Bcrypt.gen_salt/2
    (bcrypt_elixir) lib/bcrypt.ex:88: Bcrypt.hash_pwd_salt/2
    priv/repo/seeds.exs:24: (file)
    (elixir) lib/code.ex:629: Code.load_file/2
{"time":"2018-07-20 15:14:57.804","pid":"#PID<0.826.0>","msg":"The on_load function for module Elixir.Bcrypt.Base returned:\n{%RuntimeError{message: \"An error occurred when loading Bcrypt.\\nMake sure you have a C compiler and Erlang 20 installed.\\nIf you are not using Erlang 20, either upgrade to Erlang 20 or\\nuse version 0.12 of bcrypt_elixir.\\nSee the Comeonin wiki for more information.\\n\"}, [{Bcrypt.Base, :init, 0, [file: 'lib/bcrypt/base.ex', line: 17]}, {:code_server, :\"-handle_on_load/5-fun-0-\", 1, [file: 'code_server.erl', line: 1340]}]}\n","level":"warn","error_logger":"format"}
{"time":"2018-07-20 15:14:57.806","pid":"#PID<0.712.0>","msg":"GenServer #PID<0.712.0> terminating\n** (UndefinedFunctionError) function Bcrypt.Base.gensalt_nif/3 is undefined (module Bcrypt.Base is not available)\n    (bcrypt_elixir) Bcrypt.Base.gensalt_nif([60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98)\n    (bcrypt_elixir) lib/bcrypt.ex:52: Bcrypt.gen_salt/2\n    (bcrypt_elixir) lib/bcrypt.ex:88: Bcrypt.hash_pwd_salt/2\n    priv/repo/seeds.exs:24: (file)\n    (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6\n    (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3\n    (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3\n    (elixir) lib/code.ex:629: Code.load_file/2\nLast message: {:EXIT, #PID<0.74.0>, {%UndefinedFunctionError{arity: 3, exports: nil, function: :gensalt_nif, module: Bcrypt.Base, reason: nil}, [{Bcrypt.Base, :gensalt_nif, [[60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98], []}, {Bcrypt, :gen_salt, 2, [file: 'lib/bcrypt.ex', line: 52]}, {Bcrypt, :hash_pwd_salt, 2, [file: 'lib/bcrypt.ex', line: 88]}, {:elixir_compiler_2, :__FILE__, 1, [file: 'priv/repo/seeds.exs', line: 24]}, {:elixir_compiler, :dispatch, 6, [file: 'src/elixir_compiler.erl', line: 85]}, {:elixir_lexical, :run, 3, [file: 'src/elixir_lexical.erl', line: 18]}, {:elixir_compiler, :quoted, 3, [file: 'src/elixir_compiler.erl', line: 27]}, {Code, :load_file, 2, [file: 'lib/code.ex', line: 629]}]}}","level":"error","error_logger":"format"}
{"time":"2018-07-20 15:14:57.807","pid":"#PID<0.716.0>","msg":"GenServer #PID<0.716.0> terminating\n** (UndefinedFunctionError) function Bcrypt.Base.gensalt_nif/3 is undefined (module Bcrypt.Base is not available)\n    (bcrypt_elixir) Bcrypt.Base.gensalt_nif([60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98)\n    (bcrypt_elixir) lib/bcrypt.ex:52: Bcrypt.gen_salt/2\n    (bcrypt_elixir) lib/bcrypt.ex:88: Bcrypt.hash_pwd_salt/2\n    priv/repo/seeds.exs:24: (file)\n    (elixir) src/elixir_compiler.erl:85: :elixir_compiler.dispatch/6\n    (elixir) src/elixir_lexical.erl:18: :elixir_lexical.run/3\n    (elixir) src/elixir_compiler.erl:27: :elixir_compiler.quoted/3\n    (elixir) lib/code.ex:629: Code.load_file/2\nLast message: {:EXIT, #PID<0.74.0>, {%UndefinedFunctionError{arity: 3, exports: nil, function: :gensalt_nif, module: Bcrypt.Base, reason: nil}, [{Bcrypt.Base, :gensalt_nif, [[60, 82, 233, 149, 33, 172, 112, 100, 157, 214, 2, 171, 128, 189, 134, 157], 4, 98], []}, {Bcrypt, :gen_salt, 2, [file: 'lib/bcrypt.ex', line: 52]}, {Bcrypt, :hash_pwd_salt, 2, [file: 'lib/bcrypt.ex', line: 88]}, {:elixir_compiler_2, :__FILE__, 1, [file: 'priv/repo/seeds.exs', line: 24]}, {:elixir_compiler, :dispatch, 6, [file: 'src/elixir_compiler.erl', line: 85]}, {:elixir_lexical, :run, 3, [file: 'src/elixir_lexical.erl', line: 18]}, {:elixir_compiler, :quoted, 3, [file: 'src/elixir_compiler.erl', line: 27]}, {Code, :load_file, 2, [file: 'lib/code.ex', line: 629]}]}}","level":"error","error_logger":"format"}

Environment:
macOS 10.13.4
Docker 18.03.1-ce-mac64
docker-compose 1.21.0
elixir 1.6.4

TokenMissingError

Just added to my mix.exs as directed, ran my tests, then ran with test.watch and I get an exception:

$ mix test
.......

Finished in 0.8 seconds
7 tests, 0 failures

Randomized with seed 357360
$ mix test.watch

Running tests...
** (TokenMissingError) nofile:1: missing terminator: ) (for "(" starting at line 1)
    (elixir) lib/code.ex:168: Code.eval_string/3
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:651: Enum.each/2
    (mix) lib/mix/tasks/run.ex:67: Mix.Tasks.Run.run/1
    (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2

For reference, my mix.lock shows (in case this is version-specific):

"mix_test_watch": {:hex, :mix_test_watch, "0.2.6", "9fcc2b1b89d1594c4a8300959c19d50da2f0ff13642c8f681692a6e507f92cab", [:mix], [{:fs, "~> 0.9.1", [hex: :fs, optional: false]}]}

Elixir: 1.3.0, MacOS X.

Random failures

I wrote a small library for internal use that uses redis for some queues handling.

Now, one thing that I've noticed is that while saving sometimes the test fails, looking at redis messages everything seems working correctly, but test fails pretty often on tests with multiple asserts, like 20-30% of the times.

Trying instead with a bash script while mix test --raise; do :; done runs thousands of time without a failed test.

Could be something in this library that could cause the issue? Because is the only variable between these two tests.

Run only tests from changed file?

Is it possible to only run the tests associated with the file that was changed? So for example if web/controllers/page_controller.ex to only run the tests in test/controllers/page_controller_test.ex.

Then it should also run if the page_controller_test.ex is changed.

This is how kovacs works. It would be awesome to get the functionality of kovacs with the ease of use of mix test.watch

File changes not notified in Docker

Docker for Mac, all versions that I've tried. I don't know about other versions of Docker. The watcher waits but nothing happens, basically, but I think it's actually a bug (or limitation) in Docker for Mac itself or the way it operates, but I am reporting it here so that it can be logged and thus so can a potential workaround.

I will take a look into this myself anyway, as I am able to use inotifywait manually and watch file changes - but only if I use something like -qre attrib. This only tool isn't the only one having issues something is definitely wonky somewhere.

Unable to run with Phoenix

When grabbing the latest from master, I'm seeing the following:

[error] GenServer MixTestWatch.Watcher terminating
** (RuntimeError) cannot begin test transaction with pool Ecto.Pools.Poolboy.
In order to use test transactions with Ecto SQL, you need to
configure your repository to use Ecto.Adapters.SQL.Sandbox:

    pool: Ecto.Adapters.SQL.Sandbox

    (ecto) lib/ecto/adapters/sql.ex:396: Ecto.Adapters.SQL.test_transaction/3
    (elixir) src/elixir_compiler.erl:125: :elixir_compiler.dispatch_loaded/6
    (elixir) src/elixir_lexical.erl:16: :elixir_lexical.run/3
    (elixir) src/elixir_compiler.erl:30: :elixir_compiler.quoted/3
    (elixir) lib/code.ex:363: Code.require_file/2
    (elixir) lib/enum.ex:604: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:604: Enum.each/2
    (mix) lib/mix/tasks/test.ex:186: Mix.Tasks.Test.run/1
    (mix_test_watch) lib/mix_test_watch/test_task.ex:9: MixTestWatch.TestTask.run/1
    (elixir) lib/enum.ex:604: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:604: Enum.each/2
    (mix_test_watch) lib/mix_test_watch/watcher.ex:69: MixTestWatch.Watcher.do_run_tasks/1
    (mix_test_watch) lib/mix_test_watch/watcher.ex:41: MixTestWatch.Watcher.handle_cast/2
    (stdlib) gen_server.erl:615: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:681: :gen_server.handle_msg/5
    (stdlib) proc_lib.erl:240: :proc_lib.init_p_do_apply/3
Last message: {:"$gen_cast", :run_tasks}
State: []

Running with {:mix_test_watch, "~> 0.2", only: :dev} seems to work just fine.

CLI flags are passed to all tests

I have the following config:

if Mix.env == :dev do
  config :mix_test_watch,
    tasks: [
      "test",
      "credo",
      "dialyzer",      
    ]
end

However, when I run from the CLI with something like:

mix test.watch --only wip

This works for the "test" task, but also passes the flags to "dialyzer" which causes it to fail:

dialyzer: Unknown option: --only

Does not play well with Ecto Migrations

If you use mix ecto.gen.migration while mix-test.watch is running, the empty migration gets applied immediately. Then when you update the file with the code for your DB change, it won't get applied in the test env. Currently you have to remember to stop mix-test.watch before generating a migration. Otherwise, you have to drop/create/migrate your test DB once you've finished your migration.

It would be nice if mix-test.watch either ignored the priv/repo/migrations directory or prompted the user before running the tests when the change involves migrations. This would allow a user to more easily prevent this situation.

Syntax error in a test results in all later recompilations to fail.

%%% elixir_module.erl
build(Line, File, Module, Docs, Lexical) ->
  case ets:lookup(elixir_modules, Module) of
    [{Module, _, _, OldLine, OldFile}] ->
      Error = {module_in_definition, Module, OldFile, OldLine},
      elixir_errors:form_error([{line, Line}], File, ?MODULE, Error);
    _ ->
      []
  end,

Here we explode if we try and compile a module that is already open. It's open if it's in the elixir_modules ETS table.

The table is protected, so only the other can delete the entry from the table.

The owner process has no API for deleting this unless you have the ref it creates when inserting it. See elixir_code_server:defmodule/3

%%% elixir_code_server.erl
defmodule(Pid, Tuple, #elixir_code_server{mod_ets=ModEts} = Config) ->
  ets:insert(elixir_modules, Tuple),
  Ref = erlang:monitor(process, Pid),
  Mod = erlang:element(1, Tuple),
  {Ref, Config#elixir_code_server{mod_ets=maps:put(Ref, Mod, ModEts)}}.

undefmodule(Ref, #elixir_code_server{mod_ets=ModEts} = Config) ->
  case maps:find(Ref, ModEts) of
    {ok, Mod} ->
      ets:delete(elixir_modules, Mod),
      Config#elixir_code_server{mod_ets=maps:remove(Ref, ModEts)};
    error ->
      Config
  end.

:(

Does not work on 1.3.0

with elixir 1.3.0, mix_test_watch 0.2.6, I get:

โ‡’ mix test.watch

Running tests...
** (TokenMissingError) nofile:1: missing terminator: ) (for "(" starting at line 1)
    (elixir) lib/code.ex:168: Code.eval_string/3
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2
    (elixir) lib/enum.ex:651: Enum.each/2
    (mix) lib/mix/tasks/run.ex:67: Mix.Tasks.Run.run/1
    (mix) lib/mix/task.ex:296: Mix.Task.run_task/3
    (elixir) lib/enum.ex:651: Enum."-each/2-lists^foreach/1-0-"/2

when mix test runs and passes.

Normally I'd try to do some digging to figure out what's going on, but I'm not sure where to look with that anonymous stack trace. Let me know if there's additional information about my project I can provide (if this is not a general problem)

run dependent tests when source file changes

Hello,

I was looking into switching to this tool from a shell script I wrote :neckbeard: that does nearly the same thing.

However, I noticed that this tool runs all tests whenever a source file changes. This makes my TDD feedback loop longer than I'd like because I have to wait for unrelated tests to finish running. ๐ŸŒ

Instead, when I modify a lib/*.ex file, I only want its corresponding test and any dependent tests to run. For example, my shell script does this by running mix compile and looking at what files are recompiled. Then, it maps each of those recompiled source files to their corresponding tests and runs them too. ๐ŸŽ…

Thanks for your consideration.

Ability to IEx.pry within test run?

Trying to figure out if there's a way to IEx.pry within the sourcecode whilst running the tests with mix test.watch. I tried using the prefix config set to iex -S mix but I still get an error that an iex session is not running.

Config:

config :mix_test_watch,
  prefix: "iex -S mix"

When running via mix test.watch:

> mix test.watch

Running tests...
Eshell V8.0.2  (abort with ^G)
Cannot pry #PID<0.168.0> at lib/slacktappdex.ex:10. Is an IEx shell running?
.

Finished in 5.0 seconds
1 test, 0 failures

Randomized with seed 132540
Interactive Elixir (1.3.2) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)>

Running mix test with the same code successfully fires the pry:

> iex -S mix test
Erlang/OTP 19 [erts-8.0.2] [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]

Request to pry #PID<0.167.0> at lib/slacktappdex.ex:10

         |> Poison.decode!

        IEx.pry
      end
    end

Allow? [Yn]

:init.restart()

I am not sure this is the best way to let you know but I have just found out there is a command called :init.restart() that will restart the whole system, shutting down all applications and starting them again. For example, if you do:

$ iex -S mix test
iex> :init.restart()

It will restart everything and run the tests again. Maybe this can be used to make this project much more straight-forward. :)

Failed to start Watcher

I'm using mix test.watch in an umbrella project, I had to override the fs dependency to 2.11.0 due to 5HT/fs#40

When I try to run test.watch I get

11:27:59.314 [info]  Application mix_test_watch exited: MixTestWatch.start(:normal, []) returned an error: shutdown: failed to start child: MixTestWatch.Watcher
    ** (EXIT) no process: the process is not alive or there's no process currently associated with the given name, possibly because its application isn't started
** (MatchError) no match of right hand side value: {:error, {{:shutdown, {:failed_to_start_child, MixTestWatch.Watcher, :noproc}}, {MixTestWatch, :start, [:normal, []]}}}
    (mix_test_watch) lib/mix_test_watch.ex:19: MixTestWatch.run/1
    (mix) lib/mix/task.ex:294: Mix.Task.run_task/3
    (mix) lib/mix/cli.ex:58: Mix.CLI.run_task/2
    (elixir) lib/code.ex:370: Code.require_file/2

any idea?

Remove bash dependency

bash is used here but isn't available on all platforms. To be more specific, I'm running Elixir in a Docker container based on Alpine Linux which only ships with a version of sh. sh seems pretty common across most *nix environments, and I imagine the line I referenced above could be modified to use sh making this project compatible with a wider range of use cases.

ArgumentError when running `mix test.watch`

Trying to run mix test.watch gives me the following output:

** (ArgumentError) argument error
    (stdlib) :ets.lookup_element(Ecto.Registry, nil, 3)
    (ecto) lib/ecto/registry.ex:18: Ecto.Registry.lookup/1
    (ecto) lib/ecto/adapters/sql/sandbox.ex:426: Ecto.Adapters.SQL.Sandbox.mode/2
    (elixir) lib/code.ex:677: Code.require_file/2
    (elixir) lib/enum.ex:737: Enum."-each/2-lists^foreach/1-0-"/2

I am able to run the unit test with mix test though.

Problem auto running on file save with v0.3

I tried installing v0.3 on a brand new Phoenix project (Elixir v1.3.2, Phoenix 1.2, macOS 10.12.1). The test suite runs once but saving a file in ./web or ./test does not rerun the test suite. Dropping mix-test.watch back to v0.2.6 fixes the issue.

Add support for additional file types

Currently, watched file types are hardcoded within the Path module. Nice to have file types (like .haml) aren't currently supported, and therefore aren't picked up in projects using alternative templating (like Phoenix Haml )

It would be nice to have the option to include file types through the config similarly to how exclusion works.

Pass arguments to mix test?

Is there any way to pass command line arguments through to the mix test command? e.g. I want to execute

$ mix test --no-start

when running tests instead of just mix test.

Could not run ExUnitProperties

While trying to run property-based testing with mix test.watch, it's giving me following error.

** (ArgumentError) could not fetch application environment :initial_size for application :stream_data because the application was not loaded/started. If your application depends on :stream_data at runtime, make sure to load/start it or list it under :extra_applications in your mix.exs file

So far, what I understand is the application environment initially specify in stream_data's mix.exs is not be loaded properly.

Could anyone point me out where to start digging in. I'm happy to help :D

Ability to exclude files/directories

When I generate a migration using ecto migrate, the test are automatically run. This causes the test environment to run the migration. The problem is that at that point the migration is empty. If I then add my changes to the migration, I cannot migrate the test environment without a migration rollback or database wipe.
I could fix this by disabling the automatic migration of the test environment, but I actually like that the environment is automatically migrated. It would be cool to be able to make the watcher ignore the migrations directory.

Ability to run mix from IEx

I often like to put breakpoints in my code as I build it out - it would be nice if, like with rspec, I can add IEx.pry in an ExUnit test or a source file and have the test run and then pause at the breakpoint.

It seems the reason why it currently does not allow this behaviour is because no IEx shell is running. Therefore we'd need a method of configuring mix-test.watch to run a specific command (IE, something like iex -S mix #{task}).

Error/warning on test with a config

When I start a hello world app with a basic test I get the following warning when I use the config

config :mix_test_watch,
  clear: true
Running tests...
You have configured application :mix_test_watch in your configuration
file but the application is not available.

This usually means one of:

1. You have not added the application as a dependency in a mix.exs file.

2. You are configuring an application that does not really exist.

Please ensure :mix_test_watch exists or remove the configuration.

..

Finished in 0.02 seconds (0.02s on load, 0.00s on tests)
2 tests, 0 failures

However if I add it to the applications as the warning suggests I get the error:

my_app|โ‡’ mix test.watch

Running tests...

=INFO REPORT==== 24-Apr-2016::14:48:58 ===
    application: logger
    exited: stopped
    type: temporary
** (Mix) Could not start application mix_test_watch: could not find application file: mix_test_watch.app

Is it possible to have mix-test.watch clear out the console without printing the warning?


Elixir 1.2.1 Erlang/OTP 18 erts-7.2.1
defmodule MyApp.Mixfile do
  use Mix.Project

  def project do
    [app: :my_app,
     version: "0.0.1",
     elixir: "~> 1.2",
     build_embedded: Mix.env == :prod,
     start_permanent: Mix.env == :prod,
     deps: deps]
  end

  # Configuration for the OTP application
  #
  # Type "mix help compile.app" for more information
  def application do
    [applications: [:logger]]
  end

  # Dependencies can be Hex packages:
  #
  #   {:mydep, "~> 0.3.0"}
  #
  # Or git/path repositories:
  #
  #   {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
  #
  # Type "mix help deps" for more examples and options
  defp deps do
    [
      {:mix_test_watch, "~> 0.2", only: :dev},
    ]
  end
end

Ability to pass different args and use different environments for different tasks

This would be great and a lot more flexible:

# config/config.exs
use Mix.Config

if Mix.env == :dev do
  config :mix_test_watch,
    tasks: [
      {"test", args: "--stale"},
      {"dialyzer", mix_env: "dev"}
    ]
end

As noted in #56, the dialyzer task fails if passed unknown args. Also, the default env to run the task in is "dev" (I don't know if this matters much though).

The above API seems to make a lot of sense though and would offer a lot of flexibility.

Docker support?

I'm running my Phoenix app inside Docker and wondering if there's any way to get test.watch to work inside Docker?

It runs fine once, but doesn't detect filesystem changes. I have the host application folder shared with the Container, so it should pick up the changes (live reload works with the Phoenix web server).

Has anyone tried this?

Stopping on first failed test

Hi!

I've tried to implement functionality to stop mix test output after detecting first failed test. In this case running something mix test.watch --stop-on-failure --seed 0 tests/ allows work one by one on each failing tests during refactoring.

Here is the change against v0.2.6 - https://github.com/gasparch/mix-test.watch/tree/stop_on_failure

Does it make sense to you? If yes, I'll try to merge it to main tree, as I see a lot of changes happened since v0.2.6 ;)

Here is a discussion in elixir-lang (elixir-lang/elixir#4586), but looking on ExUnit sources adding this kind of functionality will be really difficult in there.

What do you think?

Exclude tmp file created by Emacs

Hi,

I'm having trouble excluding a tmp file created by Emacs.

The file is actually a symbolic link that looks similiar to

.#post_test.exs -> [email protected]

I have in my config/config.exs

if Mix.env == :dev do
  config :mix_test_watch, clear: true
  config :mix_test_watch, exclude: [~r/\.#/, ~r/~/]
end

Could you help me debug this?

It's really annoying, because this tmp file gets created very often (after saving and then changing a buffer), so I accidentally trigger more test runs than needed.

Specifying filter with describe: does not work

runinng mix test.watch test/ --only describe:"function/1" does not work, skips all tests. In other hand mix test test/ --only describe:"function/1" works as expected and runs only tests in specified describe block.

mix test.watch hangs

My mix test.watch hangs, but regular mix test does not. I am having trouble reproducing the issue in a dummy project, so I know it is something to do with my project specifically but I just can't find out what.

This is what it looks like on my command line before it hangs:

$ mix test.watch --trace

Running tests...

And that is all that I get.

I am on:
Elixir 1.7.3
Erlang 21
Debian 9.5
(specifically the elixir:1.7.3 docker image)

I can see from adding some IO.puts that my application starts up but that my test_helper.exs never runs.

What can I do to debug this further? I can't seem to find a verbose option for any of the mix commands. Is there some way I can figure out what is happening?

Support Escript?

Hi there,

would you be open to an EScript-installation contribution?
Still got a PR to open for Hacktoberfest and would shoot you one if you're down.

Watch Templates

AFAIK MixTestWatch.Path holds @elixir_source_endings so it works on the basis of exclusion and re-runs tests when Elixir files have changed.

We have tests that verify template content and ideally I would want to make the configuration more flexible and allow us to include additional extensions.

Thoughts?

--no-halt has no effect

I saw that #18 was fixed. However, even if you can pass --no-start argument to mix test, the application is still started before by:

run -e 'Application.put_env(:elixir, :ansi_enabled, true);'

I wonder if there is another way to set the env variable, without actually starting the application.

Ability to focus on some tests...

It would be nice if we could focus on some tests for a brief time:

@tag wip
test "should do foo" do
...
end

Ideally it would only run tests marked with some tags (if present) otherwise it should fall back to running everything as it normally does.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.