When I run grunt server, my file edits are picked up and the browser refreshed through livereload. When I run grunt test, it runs once and shuts down.
This behavior can be simulated by running
yo angular --minsafe mytest
grunt test
When I change karma.unit.singlerun = false in the Gruntfile, grunt test now says that a watcher is running, but no file changes seem to trigger running the tests again.
How do I get the reload capability with the tests similar to the way linemanjs works?
You were almost there! There's an additional option you can set in the Gruntfile called autoWatch
, which monitors the files specified in your karma.conf.js
for changes. A complete entry in your Gruntfile
could look like this:
karma: {
unit: {
configFile: 'karma.conf.js',
singleRun: true,
autoWatch: false
},
server: {
configFile: 'karma.conf.js',
singleRun: false,
autoWatch: true
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With