test: add some environment variables for controlling tests (#39149)

chore: add some environment variables for controlling tests
This commit is contained in:
Cheng Zhao 2023-07-19 23:54:08 +09:00 committed by GitHub
parent bbdd037219
commit cc39ddb728
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,6 +14,11 @@ process.env.ELECTRON_DISABLE_SECURITY_WARNINGS = 'true';
const { app, protocol } = require('electron'); const { app, protocol } = require('electron');
// Some Linux machines have broken hardware acceleration support.
if (process.env.ELECTRON_TEST_DISABLE_HARDWARE_ACCELERATION) {
app.disableHardwareAcceleration();
}
v8.setFlagsFromString('--expose_gc'); v8.setFlagsFromString('--expose_gc');
app.commandLine.appendSwitch('js-flags', '--expose_gc'); app.commandLine.appendSwitch('js-flags', '--expose_gc');
// Prevent the spec runner quitting when the first window closes // Prevent the spec runner quitting when the first window closes
@ -69,6 +74,14 @@ app.whenReady().then(async () => {
reporterEnabled: process.env.MOCHA_MULTI_REPORTERS reporterEnabled: process.env.MOCHA_MULTI_REPORTERS
}; };
} }
// The MOCHA_GREP and MOCHA_INVERT are used in some vendor builds for sharding
// tests.
if (process.env.MOCHA_GREP) {
mochaOptions.grep = process.env.MOCHA_GREP;
}
if (process.env.MOCHA_INVERT) {
mochaOptions.invert = process.env.MOCHA_INVERT === 'true';
}
const mocha = new Mocha(mochaOptions); const mocha = new Mocha(mochaOptions);
// Add a root hook on mocha to skip any tests that are disabled // Add a root hook on mocha to skip any tests that are disabled