2018-05-08 21:35:56 +00:00
|
|
|
// @flow
|
2018-02-18 16:13:29 +00:00
|
|
|
"use strict";
|
2018-02-17 21:28:47 +00:00
|
|
|
|
|
|
|
// Do this as the first thing so that any code reading it knows the right env.
|
2018-02-18 16:13:29 +00:00
|
|
|
process.env.BABEL_ENV = "test";
|
|
|
|
process.env.NODE_ENV = "test";
|
|
|
|
process.env.PUBLIC_URL = "";
|
2018-02-17 21:28:47 +00:00
|
|
|
|
|
|
|
// Makes the script crash on unhandled rejections instead of silently
|
|
|
|
// ignoring them. In the future, promise rejections that are not handled will
|
|
|
|
// terminate the Node.js process with a non-zero exit code.
|
2018-02-18 16:13:29 +00:00
|
|
|
process.on("unhandledRejection", (err) => {
|
2018-02-17 21:28:47 +00:00
|
|
|
throw err;
|
|
|
|
});
|
|
|
|
|
|
|
|
// Ensure environment variables are read.
|
2018-02-18 16:13:29 +00:00
|
|
|
require("../config/env");
|
2018-02-17 21:28:47 +00:00
|
|
|
|
2018-02-18 16:13:29 +00:00
|
|
|
const jest = require("jest");
|
2018-02-17 21:28:47 +00:00
|
|
|
const argv = process.argv.slice(2);
|
|
|
|
|
|
|
|
// Watch unless on CI or in coverage mode
|
2018-02-18 16:13:29 +00:00
|
|
|
if (!process.env.CI && argv.indexOf("--coverage") < 0) {
|
|
|
|
argv.push("--watch");
|
2018-02-17 21:28:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
jest.run(argv);
|