Skip to content

Commit 7d33398

Browse files
committed
feat(launcher): output stderr for failing launchers
1 parent 28e77e0 commit 7d33398

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed

Diff for: lib/launchers/process.js

+4
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,10 @@ var ProcessLauncher = function (spawn, tempDir, timer, processKillTimeout) {
7777
errorOutput += err.toString()
7878
}
7979
})
80+
81+
self._process.stderr.on('data', function (errBuff) {
82+
errorOutput += errBuff.toString()
83+
})
8084
}
8185

8286
this._onProcessExit = function (code, errorOutput) {

Diff for: test/e2e/launcher-error.feature

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Feature: Launcher error
2+
In order to use Karma
3+
As a person who wants to write great tests
4+
I want Karma to output stderr if a browser fails to connect.
5+
6+
Scenario: Broken Browser
7+
Given a configuration with:
8+
"""
9+
files = ['launcher-error/specs.js'];
10+
browsers = [__dirname + '/launcher-error/fake-browser.sh'];
11+
plugins = [
12+
'karma-jasmine',
13+
'karma-script-launcher'
14+
];
15+
"""
16+
When I run Karma
17+
Then it fails with like:
18+
"""
19+
Missing fake dependency
20+
"""

Diff for: test/e2e/support/launcher-error/fake-browser.sh

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
echo "Missing fake dependency" 1>&2
4+
exit 1

Diff for: test/e2e/support/launcher-error/specs.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
describe('something', function () {
2+
it('should never happen anyway', function () {
3+
expect(true).toBe(true)
4+
})
5+
})

0 commit comments

Comments
 (0)