Skip to content

Commit

Permalink
feat(launcher): output stderr for failing launchers
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Mar 30, 2017
1 parent 28e77e0 commit 7d33398
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/launchers/process.js
Expand Up @@ -77,6 +77,10 @@ var ProcessLauncher = function (spawn, tempDir, timer, processKillTimeout) {
errorOutput += err.toString()
}
})

self._process.stderr.on('data', function (errBuff) {
errorOutput += errBuff.toString()
})
}

this._onProcessExit = function (code, errorOutput) {
Expand Down
20 changes: 20 additions & 0 deletions test/e2e/launcher-error.feature
@@ -0,0 +1,20 @@
Feature: Launcher error
In order to use Karma
As a person who wants to write great tests
I want Karma to output stderr if a browser fails to connect.

Scenario: Broken Browser
Given a configuration with:
"""
files = ['launcher-error/specs.js'];
browsers = [__dirname + '/launcher-error/fake-browser.sh'];
plugins = [
'karma-jasmine',
'karma-script-launcher'
];
"""
When I run Karma
Then it fails with like:
"""
Missing fake dependency
"""
4 changes: 4 additions & 0 deletions test/e2e/support/launcher-error/fake-browser.sh
@@ -0,0 +1,4 @@
#!/bin/bash

echo "Missing fake dependency" 1>&2
exit 1
5 changes: 5 additions & 0 deletions test/e2e/support/launcher-error/specs.js
@@ -0,0 +1,5 @@
describe('something', function () {

This comment has been minimized.

Copy link
@benjaminapetersen

benjaminapetersen Sep 13, 2017

Surprised this made it through. I happen to be trying to figure out why karma + my launcher isn't working after I update karma to a later version.

it('should never happen anyway', function () {
expect(true).toBe(true)
})
})

0 comments on commit 7d33398

Please sign in to comment.