1 | const jest = require('jest');
|
2 | const fs = require('fs');
|
3 | const jestConfig = fs.readFileSync(`${process.cwd()}/jestConfig.json`).toString();
|
4 |
|
5 |
|
6 | process.env.BABEL_ENV = 'test';
|
7 | process.env.NODE_ENV = 'test';
|
8 | process.env.PUBLIC_URL = '';
|
9 |
|
10 | process.on('unhandledRejection', (err) => {
|
11 | throw err;
|
12 | });
|
13 |
|
14 |
|
15 | let argv = process.argv.slice(3);
|
16 |
|
17 | let cleanArgs = argv.filter((item) => {
|
18 | return item !== '--';
|
19 | });
|
20 |
|
21 |
|
22 | if (cleanArgs.indexOf('--coverage') < 0) {
|
23 | cleanArgs.push('--watch');
|
24 | }
|
25 |
|
26 | cleanArgs.push(
|
27 | '--config',
|
28 | jestConfig
|
29 | );
|
30 |
|
31 | jest.run(cleanArgs); |
\ | No newline at end of file |