From 1dc8a0a95d4d6abd2f962f36b386a68bd30030eb Mon Sep 17 00:00:00 2001 From: Marc Laval Date: Sat, 17 Oct 2015 01:01:59 +0200 Subject: [PATCH] fix(build): EMFILE error on Windows when executing JS unit tests Fixes #4525 Closes #4796 --- gulpfile.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 8df33c0ff7..d1ca01e930 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -489,7 +489,7 @@ gulp.task('test.unit.js', ['build.js.dev'], function (done) { runSequence( '!test.unit.js/karma-server', function() { - watch('modules/**', [ + watch('modules/**', { ignoreInitial: true }, [ '!broccoli.js.dev', '!test.unit.js/karma-run' ]); @@ -517,8 +517,16 @@ gulp.task('test.unit.js.sauce', ['build.js.dev'], function (done) { } }); -gulp.task('!test.unit.js/karma-server', function() { - new karma.Server({configFile: __dirname + '/karma-js.conf.js', reporters: 'dots'}).start(); +gulp.task('!test.unit.js/karma-server', function(done) { + var watchStarted = false; + var server = new karma.Server({configFile: __dirname + '/karma-js.conf.js', reporters: 'dots'}); + server.on('run_complete', function () { + if (!watchStarted) { + watchStarted = true; + done(); + } + }); + server.start(); });