karma-runner / gulp-karma

Example of using Karma with Gulp.
310 stars 41 forks source link

`done` callback not being called #10

Closed demisx closed 10 years ago

demisx commented 10 years ago

Hi. Passing done callback karma.start() like this didn't work for me. As soon as watch-unit task started, it blocked processing of the remaining tasks (the processing will resume only after I hit Ctrl + C):

gulp.task('watch-unit', function (done) {
  karma.start({
    configFile: __dirname + '/spec/config/karma-unit.conf.js',
  }, done);
});

However, calling done() directly worked OK, but I doubt this is an acceptable workaround:

gulp.task('watch-unit', function (done) {
  karma.start({
    configFile: __dirname + '/spec/config/karma-unit.conf.js',
  });
  done();
});

Please advise.

lunow commented 10 years ago

same here, on os x and all recent versions.

pkozlowski-opensource commented 10 years ago

@demisx @lunow sorry guys, but I don't think there is enough info here to assist you. I've just did the fresh clone of this repo and things working as expected on OSX.

Could one of you prepare a minimal reproduce scenario to expose the issue? You can start by clonning this repo.

I'm afraid that nothing is going to happen with this issue unless there we've got a small reproduce scenario...

lunow commented 10 years ago

It seems in my case the "osx reporter" was the evil part, I reproduced it here https://github.com/lunow/gulp-karma and fixed it like this

gulp.task('test', function (done) {
  karma.start({
    configFile: __dirname + '/karma.conf.js',
    singleRun: true,
    reporters: ['dots']
  }, done);
});
georgealways commented 10 years ago

Can confirm the same issue, even with a fresh clone of this repository. Running OS X 10.9.4. Here's what I get from running npm install after a fresh clone: some warnings at the top that seem suspect ...

fsevents@0.2.1 install /Users/georgebrower/Sites/gulp-karma/node_modules/karma/node_modules/chokidar/node_modules/fsevents node-gyp rebuild

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

CXX(target) Release/obj.target/fse/fsevents.o SOLINK_MODULE(target) Release/fse.node SOLINK_MODULE(target) Release/fse.node: Finished \

ws@0.4.32 install /Users/georgebrower/Sites/gulp-karma/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws (node-gyp rebuild 2> builderror.log) || (exit 0)

CXX(target) Release/obj.target/bufferutil/src/bufferutil.o SOLINK_MODULE(target) Release/bufferutil.node SOLINK_MODULE(target) Release/bufferutil.node: Finished CXX(target) Release/obj.target/validation/src/validation.o SOLINK_MODULE(target) Release/validation.node SOLINK_MODULE(target) Release/validation.node: Finished karma-chrome-launcher@0.1.4 node_modules/karma-chrome-launcher

karma-jasmine@0.2.2 node_modules/karma-jasmine

gulp@3.8.7 node_modules/gulp ├── tildify@0.2.0 ├── interpret@0.3.6 ├── pretty-hrtime@0.2.1 ├── deprecated@0.0.1 ├── archy@0.0.2 ├── minimist@0.2.0 ├── semver@3.0.1 ├── chalk@0.5.1 (escape-string-regexp@1.0.1, ansi-styles@1.1.0, supports-color@0.2.0, has-ansi@0.1.0, strip-ansi@0.3.0) ├── orchestrator@0.3.7 (stream-consume@0.1.0, sequencify@0.0.7, end-of-stream@0.1.5) ├── vinyl-fs@0.3.7 (graceful-fs@3.0.2, strip-bom@1.0.0, mkdirp@0.5.0, through2@0.6.1, glob-stream@3.1.15, vinyl@0.4.3, glob-watcher@0.0.6, lodash@2.4.1) ├── gulp-util@3.0.1 (lodash._reinterpolate@2.4.1, dateformat@1.0.8-1.2.3, minimist@1.1.0, through2@0.6.1, lodash.template@2.4.1, multipipe@0.1.1, vinyl@0.4.3, lodash@2.4.1) └── liftoff@0.12.1 (extend@1.3.0, resolve@0.7.4, findup-sync@0.1.3)

karma@0.12.23 node_modules/karma ├── di@0.0.1 ├── graceful-fs@2.0.3 ├── rimraf@2.2.8 ├── colors@0.6.2 ├── mime@1.2.11 ├── q@0.9.7 ├── minimatch@0.2.14 (sigmund@1.0.0, lru-cache@2.5.0) ├── source-map@0.1.38 (amdefine@0.1.0) ├── optimist@0.6.1 (wordwrap@0.0.2, minimist@0.0.10) ├── glob@3.2.11 (inherits@2.0.1, minimatch@0.3.0) ├── lodash@2.4.1 ├── log4js@0.6.20 (semver@1.1.4, async@0.1.15, readable-stream@1.0.31) ├── http-proxy@0.10.4 (pkginfo@0.3.0, utile@0.2.1) ├── useragent@2.0.9 (lru-cache@2.2.4) ├── chokidar@0.8.4 (recursive-readdir@0.0.2, fsevents@0.2.1) ├── connect@2.12.0 (uid2@0.0.3, methods@0.1.0, debug@0.8.1, pause@0.0.1, cookie-signature@1.0.1, fresh@0.2.0, qs@0.6.6, bytes@0.2.1, buffer-crc32@0.2.1, raw-body@1.1.2, batch@0.5.0, cookie@0.1.0, negotiator@0.3.0, send@0.1.4, multiparty@2.2.0) └── socket.io@0.9.17 (base64id@0.1.0, policyfile@0.0.4, redis@0.7.3, socket.io-client@0.9.16)

pkozlowski-opensource commented 10 years ago

@georgealways what you are seeing here is the npm installation problem with an upstream library, see https://github.com/TooTallNate/node-gyp/issues/341. I don't think it has anything to do with the problem being discussed here.

pkozlowski-opensource commented 10 years ago

@georgealways despite this warning I think that the whole thing should be installed but without compiling native modules. What command did you run after install and how did you determine that the done callback is not being invoked?

Once again, if you want to see any progress here we need to have small, clear reproduce scenario....

georgealways commented 10 years ago

@pkozlowski-opensource thanks for looking into this, very curious that the same code is giving us different results.

So I'm just trying to issue gulp test ... here's how I've determined done isn't being called

https://github.com/georgealways/gulp-karma/blob/master/gulpfile.js#L11-L16

So something must be hanging because I'm not seeing any "hello?" and Control+C doesn't kill the process: I have to kill the entire terminal session.

pkozlowski-opensource commented 10 years ago

@demisx yeh, I'm afraid that we get a situation where there is something environment-specific that makes the whole thing fail on your machine... It is stabbing in the dark, but what is your node version? What versions of Karma gets installed in your setup?

pkozlowski-opensource commented 10 years ago

Closing this one as we don't have any reproduce scenario...