Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I get Yeoman to continuously run tests

Tags:

gruntjs

yeoman

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?

like image 210
Dennis Burton Avatar asked Aug 24 '13 03:08

Dennis Burton


1 Answers

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
  }
}
like image 104
passy Avatar answered Oct 13 '22 13:10

passy