test.js 867 B

12345678910111213141516171819202122232425262728
  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. // Marker to indicate that we've correctly ran with `yarn test`.
  8. process.env.USING_YARN_TEST = true;
  9. // Makes the script crash on unhandled rejections instead of silently
  10. // ignoring them. In the future, promise rejections that are not handled will
  11. // terminate the Node.js process with a non-zero exit code.
  12. process.on('unhandledRejection', err => {
  13. throw err;
  14. });
  15. const jest = require('jest');
  16. let argv = process.argv.slice(2);
  17. // Remove watch if in CI or in coverage mode
  18. if (process.env.CI || process.env.SENTRY_PRECOMMIT || argv.includes('--coverage')) {
  19. argv = argv.filter(arg => arg !== '--watch');
  20. }
  21. jest.run(argv);