react仪表盘

test.js 811B

1234567891011121314151617181920212223242526272829303132
  1. 'use strict';
  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. // Makes the script crash on unhandled rejections instead of silently
  7. // ignoring them. In the future, promise rejections that are not handled will
  8. // terminate the Node.js process with a non-zero exit code.
  9. process.on('unhandledRejection', err => {
  10. throw err;
  11. });
  12. // Ensure environment variables are read.
  13. require('../config/env');
  14. const jest = require('jest');
  15. let argv = process.argv.slice(2);
  16. // Watch unless on CI, in coverage mode, or explicitly running all tests
  17. if (
  18. !process.env.CI &&
  19. argv.indexOf('--coverage') === -1 &&
  20. argv.indexOf('--watchAll') === -1
  21. ) {
  22. argv.push('--watch');
  23. }
  24. jest.run(argv);