-
-
Notifications
You must be signed in to change notification settings - Fork 520
/
.mocharc.js
47 lines (40 loc) · 1.23 KB
/
.mocharc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const path = require('path');
const minimist = require('minimist');
const {
_: [_node, _mocha, ...args], // _ contains the node binary, the mocha binary, and any positional args
...flags
} = minimist(process.argv);
process.env.LINK_FORGE_DEPENDENCIES_ON_INIT = true;
let testGlob;
/**
* Determine which sets of tests to run. Priority goes:
* 1. If positional arguments are passed in, run those files.
* 2. If `--suite` is either slow or fast, run slow or fast test.
* 3. Otherwise, run all spec tests.
*/
if (args.length === 0) {
if (flags.suite === 'fast') {
testGlob = 'packages/**/*_spec.ts';
} else if (flags.suite === 'slow') {
testGlob = 'packages/**/*_spec_slow.ts';
} else {
testGlob = 'packages/**/**/*_spec*';
}
}
// In CI, use the JUnit reporter to upload results to CircleCI.
// Locally, use the default 'spec' reporter.
const reporterConfig = process.env.CI
? {
reporter: 'mocha-junit-reporter',
'reporter-option': ['mochaFile=./reports/out/test_output.xml'],
}
: {};
const opts = {
extension: ['ts'],
require: ['ts-node/register', path.join(__dirname, 'tools', 'test-setup.ts')],
spec: testGlob,
timeout: 800000,
recursive: true,
...reporterConfig,
};
module.exports = opts;