/ embark-ui / scripts / test.js
test.js
 1  'use strict';
 2  
 3  // Do this as the first thing so that any code reading it knows the right env.
 4  process.env.BABEL_ENV = 'test';
 5  process.env.NODE_ENV = 'test';
 6  process.env.PUBLIC_URL = '';
 7  
 8  // Makes the script crash on unhandled rejections instead of silently
 9  // ignoring them. In the future, promise rejections that are not handled will
10  // terminate the Node.js process with a non-zero exit code.
11  process.on('unhandledRejection', err => {
12    throw err;
13  });
14  
15  // Ensure environment variables are read.
16  require('../config/env');
17  
18  const jest = require('jest');
19  let argv = process.argv.slice(2);
20  
21  // Watch unless on CI or in coverage mode
22  if (!process.env.CI && argv.indexOf('--coverage') < 0) {
23    argv.push('--watch');
24  }
25  
26  
27  jest.run(argv);