diff --git a/lib/launchers/process.js b/lib/launchers/process.js index f82bf7167..015af70ab 100644 --- a/lib/launchers/process.js +++ b/lib/launchers/process.js @@ -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) { diff --git a/test/e2e/launcher-error.feature b/test/e2e/launcher-error.feature new file mode 100644 index 000000000..35ffa2a11 --- /dev/null +++ b/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 + """ diff --git a/test/e2e/support/launcher-error/fake-browser.sh b/test/e2e/support/launcher-error/fake-browser.sh new file mode 100755 index 000000000..f231d568c --- /dev/null +++ b/test/e2e/support/launcher-error/fake-browser.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Missing fake dependency" 1>&2 +exit 1 diff --git a/test/e2e/support/launcher-error/specs.js b/test/e2e/support/launcher-error/specs.js new file mode 100644 index 000000000..50e6b53ea --- /dev/null +++ b/test/e2e/support/launcher-error/specs.js @@ -0,0 +1,5 @@ +describe('something', function () { + it('should never happen anyway', function () { + expect(true).toBe(true) + }) +})