test.js 813 B

1234567891011121314151617181920212223242526
  1. /* global process */
  2. // Do this as the first thing so that any code reading it knows the right env.
  3. // process.env.BABEL_ENV = 'test';
  4. process.env.NODE_ENV = 'test';
  5. process.env.PUBLIC_URL = '';
  6. process.env.TZ = 'America/New_York';
  7. // Makes the script crash on unhandled rejections instead of silently
  8. // ignoring them. In the future, promise rejections that are not handled will
  9. // terminate the Node.js process with a non-zero exit code.
  10. process.on('unhandledRejection', err => {
  11. throw err;
  12. });
  13. // eslint-disable-next-line jest/no-jest-import
  14. const jest = require('jest');
  15. let argv = process.argv.slice(2);
  16. // Remove watch if in CI or in coverage mode
  17. if (process.env.CI || process.env.SENTRY_PRECOMMIT || argv.includes('--coverage')) {
  18. argv = argv.filter(arg => arg !== '--watch');
  19. }
  20. jest.run(argv);