Skip to content

Commit

Permalink
spec: preserve stderr from the browser, refs SD-2148
Browse files Browse the repository at this point in the history
test plan:
1. see previous patchset build where Xvfb was intentionally killed
2. note the `ERROR:browser_main_loop.cc(272)] Gtk: cannot open display: :20.0`

Change-Id: Ia7bd7f82e85972c25fe7221cb2441473a3267936
Reviewed-on: https://gerrit.instructure.com/106517
Tested-by: Jenkins
Reviewed-by: Landon Wilkins <lwilkins@instructure.com>
Product-Review: Landon Wilkins <lwilkins@instructure.com>
QA-Review: Landon Wilkins <lwilkins@instructure.com>
  • Loading branch information
jenseng committed Mar 27, 2017
1 parent f4a51cf commit 06d3bf9
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions karma.debugging.js
@@ -0,0 +1,24 @@
/* preserve stderr from chrome/etc., so we can know why it fails, e.g.
*
* [7644:7644:0327/202136.818897:ERROR:browser_main_loop.cc(272)] Gtk: cannot open display:
*
* this is a bit hacky... karma DI plugin stuff is magical and crazy 'n
* all, but it doesn't let you override ProcessLauncher stuff (unless you
* also want to copypasta all of karma-chrome-launcher and more). so
* just override this one thing before karma proper loads up
*/

const ProcessLauncher = require('karma/lib/launchers/process')
const tempDir = require('karma/lib/temp_dir')
const { spawn } = require('child_process')

ProcessLauncher.decoratorFactory = function (timer) {
return function (launcher, processKillTimeout) {
const spawnWithStderrPassthrough = function (command, args = [], options = {}) {
const newOptions = Object.assign({}, options)
newOptions.stdio = ['ignore', 'ignore', 'inherit']
return spawn.call(null, command, args, newOptions)
}
ProcessLauncher.call(launcher, spawnWithStderrPassthrough, tempDir, timer, processKillTimeout)
}
}
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -112,7 +112,7 @@
},
"repository": "instructure/canvas-lms",
"scripts": {
"test": "karma start --single-run",
"test": "node -r ./karma.debugging.js node_modules/.bin/karma start --single-run",
"test-watch": "karma start",
"preinstall": "script/gem_npm install",
"preupdate": "script/gem_npm update",
Expand Down

0 comments on commit 06d3bf9

Please sign in to comment.