mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
Tests
This commit is contained in:
parent
95189158c0
commit
b3b72683d0
@ -60,6 +60,22 @@ for (const arg of process.argv) {
|
|||||||
// start and end of the worker process.
|
// start and end of the worker process.
|
||||||
if (process.env.MOCHA_WORKER_ID !== undefined &&
|
if (process.env.MOCHA_WORKER_ID !== undefined &&
|
||||||
process.env.MOCHA_WEBDRIVER !== undefined) {
|
process.env.MOCHA_WEBDRIVER !== undefined) {
|
||||||
const {getMochaHooks} = require('mocha-webdriver');
|
const {getMochaHooks, setDriver, createDriver, stackWrapDriverMethods} = require('mocha-webdriver');
|
||||||
exports.mochaHooks = getMochaHooks();
|
const mochaHooks = getMochaHooks();
|
||||||
|
mochaHooks.beforeAll = async function() {
|
||||||
|
console.debug('Hijiking mocha webdriver');
|
||||||
|
const oldDriver = setDriver(null);
|
||||||
|
if (oldDriver) {
|
||||||
|
setDriver(oldDriver);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.timeout('20s');
|
||||||
|
stackWrapDriverMethods();
|
||||||
|
|
||||||
|
setDriver(await createDriver().catch(err => {
|
||||||
|
console.error('Failed to create driver:', err);
|
||||||
|
throw err;
|
||||||
|
}));
|
||||||
|
};
|
||||||
|
exports.mochaHooks = mochaHooks;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user