antonmi / espec

Elixir Behaviour Driven Development
Other
808 stars 62 forks source link

mix espec.watch #306

Open jfacoustic opened 2 years ago

jfacoustic commented 2 years ago

It would be nice to be able watch for changes in the code and automatically run the respective tests.

antonmi commented 2 years ago

Hey @jfacoustic ! I think 'mix espec --stale' is something similar. Check this PR: https://github.com/antonmi/espec/pull/292 But watching files is a good idea. If you have enthusiasm, PR are welcome!

treble37 commented 1 year ago

If you're building an application with ESpec, I think you can do this now with https://github.com/lpil/mix-test.watch. Just have to install the dependency and then modify config/config.exs with:

if Mix.env() == :dev do
  config :mix_test_watch,
    tasks: [
      "espec"
    ]
end

Seems to work using https://github.com/antonmi/espec_phoenix as a test application with Espec 1.9.0. Maybe we should just document the usage of this in the README instead?