Max Koretskyi
Max Koretskyi

Reputation: 105563

should karma stop watching when test fails

I have karma setup to watch test files. Whenever I change the test is run and I get the following as an output:

Chrome 39.0.2171 (Windows 7): Executed 1 of 1 SUCCESS (0.055 secs / 0.053 secs)

However, if I change a test file so that test fails and I get the following output:

Chrome 39.0.2171 (Windows 7): Executed 0 of 0 ERROR (0.002 secs / 0 secs)

Karma seems to stop watching my files because when I change the file back to the version where test succeeds there is no output when I save my file. Is this an expected behavior?

Upvotes: 1

Views: 559

Answers (1)

Lucio
Lucio

Reputation: 5438

Oh, I thing I know what could be happening. You have the watch task after the karma task on your Gruntfile.

grunt.registerTask('test', [
    'concurrent:test',
    'connect:test',
    'karma',
    'watch:jsTest'
  ]);

If the karma task fails then watch won't get called. If it success, watch will have the opportunity to run after that.

grunt.registerTask('test', [
    'concurrent:test',
    'connect:test',
    'watch:jsTest',
    'karma'
  ]);

Here, you ensure that watch will keep running even if later the karma task fails.

Upvotes: 1

Related Questions