forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathkarma.debugging.js
More file actions
24 lines (22 loc) · 1.05 KB
/
Copy pathkarma.debugging.js
File metadata and controls
24 lines (22 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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)
}
}