Skip to content

Commit 76e36d5

Browse files
authoredJul 20, 2020
test: Set custom mocha timeout from MOCHA_TIMEOUT environment variable
1 parent 39da52f commit 76e36d5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed
 

‎scripts/lib/mocha.js

+7
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ const runMocha = (args, execMochaOptions = {}, coverageEnabled) => {
1313
const mochaPath = which('mocha');
1414
const binArgs = coverageEnabled ? [mochaPath, ...args] : args;
1515
const binPath = coverageEnabled ? which('nyc') : mochaPath;
16+
17+
if (process.env.MOCHA_TIMEOUT) {
18+
const {MOCHA_TIMEOUT} = process.env;
19+
binArgs.push('--timeout', MOCHA_TIMEOUT);
20+
shell.echo(`\nSetting mocha timeout from env var: ${MOCHA_TIMEOUT}\n`);
21+
}
22+
1623
const res = spawnSync(binPath, binArgs, {
1724
...execMochaOptions,
1825
stdio: 'inherit',

0 commit comments

Comments
 (0)
Please sign in to comment.