test.js 833 B

123456789101112131415161718192021222324252627
  1. /* global process */
  2. /* eslint import/no-nodejs-modules:0 */
  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. process.env.TZ = 'America/New_York';
  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. // eslint-disable-next-line jest/no-jest-import
  15. const jest = require('jest');
  16. const argv = process.argv.slice(2);
  17. // Watch unless on CI or in coverage mode
  18. if (!process.env.CI && !process.env.SENTRY_PRECOMMIT && argv.indexOf('--coverage') < 0) {
  19. argv.push('--watch');
  20. }
  21. jest.run(argv);