You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I switched to Gulp not too long ago and I setup a watch task to run my mocha tests as soon as one of the code or spec files are saved.
For a couple of weeks I couldn't understand what I was doing wrong and why my tests eventually kept on failing in the watch task but were fine when run from the CLI with mocha test.
I eventually discovered that it's because gulp-mocha runs the tests in the same process as Gulp and so mocha's state isn't 100% reset between runs.
Then I came across gulp-spawn-mocha which addresses this very issue.
The README should come with a warning when using gulp-mocha in a watch task. I wasted a lot of time trying to figure it out and was almost ready to give up Gulp.
The text was updated successfully, but these errors were encountered:
I switched to Gulp not too long ago and I setup a watch task to run my mocha tests as soon as one of the code or spec files are saved.
For a couple of weeks I couldn't understand what I was doing wrong and why my tests eventually kept on failing in the watch task but were fine when run from the CLI with
mocha test
.I eventually discovered that it's because
gulp-mocha
runs the tests in the same process as Gulp and so mocha's state isn't 100% reset between runs.Then I came across
gulp-spawn-mocha
which addresses this very issue.The README should come with a warning when using
gulp-mocha
in a watch task. I wasted a lot of time trying to figure it out and was almost ready to give up Gulp.The text was updated successfully, but these errors were encountered: