Skip to content

Commit

Permalink
Merge pull request #2639 from twolfson/dev/better.launch.fail.errors.…
Browse files Browse the repository at this point in the history
…sqwished

feat(launcher): output stderr for failing launchers
  • Loading branch information
dignifiedquire committed Apr 5, 2017
2 parents 17c2c43 + 7d33398 commit 3263c06
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
describe('something', function () {
it('should never happen anyway', function () {
expect(true).toBe(true)
})
})

0 comments on commit 3263c06

Please sign in to comment.