Skip to content

Commit

Permalink
test: support for adding extra module paths (#26543)
Browse files Browse the repository at this point in the history
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
  • Loading branch information
trop[bot] and dsanders11 committed Nov 18, 2020
1 parent e119699 commit 680569e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions spec-main/index.js
Expand Up @@ -4,6 +4,13 @@ const v8 = require('v8');

Module.globalPaths.push(path.resolve(__dirname, '../spec/node_modules'));

// Extra module paths which can be used to load Mocha reporters
if (process.env.ELECTRON_TEST_EXTRA_MODULE_PATHS) {
for (const modulePath of process.env.ELECTRON_TEST_EXTRA_MODULE_PATHS.split(':')) {
Module.globalPaths.push(modulePath);
}
}

// We want to terminate on errors, not throw up a dialog
process.on('uncaughtException', (err) => {
console.error('Unhandled exception in main spec runner:', err);
Expand Down
8 changes: 8 additions & 0 deletions spec/static/index.html
Expand Up @@ -5,10 +5,18 @@
// Deprecated APIs are still supported and should be tested.
process.throwDeprecation = false

const Module = require('module');
const path = require('path')
const electron = require('electron')
const { ipcRenderer } = electron

// Extra module paths which can be used to load Mocha reporters
if (process.env.ELECTRON_TEST_EXTRA_MODULE_PATHS) {
for (const modulePath of process.env.ELECTRON_TEST_EXTRA_MODULE_PATHS.split(':')) {
Module.globalPaths.push(modulePath);
}
}

// Set up chai-as-promised here first to avoid conflicts
// It must be loaded first or really strange things happen inside
// chai that cause test failures
Expand Down

0 comments on commit 680569e

Please sign in to comment.