knpwrs/gulp-spawn-mocha

Failed to open socket on port 5858, waiting 1000 ms before retrying

Closed this issue · 3 comments

Perhaps I have the plugin configured incorrectly, but once in a while, if the code somehow throws an uncaught error, my cli spins off into never ending sequence of these messages:

Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying
Failed to open socket on port 5858, waiting 1000 ms before retrying

This happens sometimes during the tdd-* tasks, using gulp watch

function testServer() {
  return gulp.src(['test/**/*_test.js'], {read: false}).pipe(mocha({
    r: 'test/setup.js',
    // configuration @see https://github.com/Bartvds/mocha-unfunk-reporter
    R: 'mocha-unfunk-reporter',
    debug: true,
    growl: true
  })).on('error', console.warn.bind(console));
}

gulp.task('tdd-server', function () {
  gulp.watch(['./src/server/**/*.js', './test/**/*_test.js'], testServer);
  testServer();
});

Then I have to go manually kill the additional pidof node processes to clean it up. AFAICT I'm not specifying node run in debug mode for tests, nor spawning node-inspector. I do have that stuff in the gulpfile.js but not as part of the testing tasks.

Is there a better way to configure this?

Well, you have debug set to true in a gulp.watch. You probably don't want to do that. You can conditionally set debug if you want. I can make that easier tonight by allowing false to be passed as an argument value.

Yea, thanks, I figured that out as well, and commented it out. Feel free to close out.

Just published 0.4.1 to npm which enables conditional arguments. See the documentation for more details.