Open ignatevdev opened 6 years ago
You can use nodemon
for that.
Could you show us how we could use nodemon? I'm not sure which command to execute with nodemon - nodemon adonis test
doesn't work. (Sorry, I'm very new to Adonis/Node!)
EDIT: Found the option I was looking for -x
nodemon -x adonis test
nodemon
is only included with @adonisjs/cli
, so it'd be nice to add a new Ace command there. adonis test:watch'
or adonis test -w
would make sense.
Yeah, but in that case we need to handle couple of things.
runner.before
and runner.after
Feel free to share any more insights you have
Is there any way to watch for spec changes and re-run the tests automatically instead of running the command every time manually?
Hello @ignatevdev
Perhaps this can help you, a simple implementation with onchange, unfortunately requires the installation of the package but, if it is just a development dependency, I believe that it is still viable.
Install the onchange
package:
npm i onchange --save-dev
Create the script line in your package.json:
"scripts": {
....
"test:watch": "onchange 'app/**/*.js' 'test/**/*.js' -- node ace test"`
....
}
Run npm run test:watch
and finish.
Although the topic is old, it can help someone.
Programming with tests in real time is really great!
Is there any way to watch for spec changes and re-run the tests automatically instead of running the command every time manually?