UNPKG

735 BJavaScriptView Raw
1const jest = require('jest');
2const fs = require('fs');
3const jestConfig = fs.readFileSync(`${process.cwd()}/jestConfig.json`).toString();
4
5// // Do this as the first thing so that any code reading it knows the right env.
6process.env.BABEL_ENV = 'test';
7process.env.NODE_ENV = 'test';
8process.env.PUBLIC_URL = '';
9
10process.on('unhandledRejection', (err) => {
11 throw err;
12});
13
14// ignore the first argv argument that comes from jarb test
15let argv = process.argv.slice(3);
16
17let cleanArgs = argv.filter((item) => {
18 return item !== '--';
19});
20
21// watch by default, unless we need coverage report
22if (cleanArgs.indexOf('--coverage') < 0) {
23 cleanArgs.push('--watch');
24}
25
26cleanArgs.push(
27 '--config',
28 jestConfig
29);
30
31jest.run(cleanArgs);
\No newline at end of file