Skip to content

Commit

Permalink
Moved extended options into _getOptions to fix Karma warning
Browse files Browse the repository at this point in the history
  • Loading branch information
twolfson committed Jun 18, 2019
1 parent 991902a commit 3ee7946
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions lib/electron-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ process.on('uncaughtException', function handleUncaughtException (err) {

// Load in our dependencies
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var app = require('electron').app;
var async = require('async');
Expand Down
17 changes: 8 additions & 9 deletions lib/karma-electron-launcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function ElectronBrowser(baseBrowserDecorator, args, karmaBasePath, karmaUrlRoot
var flags = args.flags || [];
var userDataDir = args.userDataDir || this._tempDir;

// Relocate extended options into temporary file
// Prepare to relocate extended options into temporary file
// DEV: Electron on Windows doesn't support `stdin` reading
// https://github.com/electron/electron/issues/4218
// DEV: We write options out now as `_getOptions` is re-run on every start (e.g. crash occurs)
Expand All @@ -42,13 +42,6 @@ function ElectronBrowser(baseBrowserDecorator, args, karmaBasePath, karmaUrlRoot
extendedOptions = extendedOptions || {};
extendedOptions.loadURLOptions = args.loadURLOptions;
}
if (extendedOptions) {
// Use temporary directory provided by karma
// https://github.com/karma-runner/karma/blob/v4.1.0/lib/launchers/process.js#L15
// DEV: File will automatically be removed by Karma which is nice
try { fs.mkdirSync(this._tempDir); } catch (err) { /* Ignore errors */ }
fs.writeFileSync(extendedOptionsFilepath, JSON.stringify(extendedOptions), 'utf8');
}

// Show depreciation warning for `--show`
if (flags.indexOf('--show') !== -1) {
Expand All @@ -62,7 +55,13 @@ function ElectronBrowser(baseBrowserDecorator, args, karmaBasePath, karmaUrlRoot
'--url', url
]);
if (args.require) { retArr = retArr.concat(['--require', args.require]); }
if (extendedOptions) { retArr = retArr.concat(['--extended-options', extendedOptionsFilepath]); }
if (extendedOptions) {
// Use temporary directory provided by karma
// https://github.com/karma-runner/karma/blob/v4.1.0/lib/launchers/process.js#L15
// DEV: File will automatically be removed by Karma which is nice
fs.writeFileSync(extendedOptionsFilepath, JSON.stringify(extendedOptions), 'utf8');
retArr = retArr.concat(['--extended-options', extendedOptionsFilepath]);
}
return retArr;
};
}
Expand Down

0 comments on commit 3ee7946

Please sign in to comment.