UNPKG

1.34 kBJavaScriptView Raw
1// @remove-on-eject-begin
2/**
3 * Copyright (c) 2015-present, Facebook, Inc.
4 * All rights reserved.
5 *
6 * This source code is licensed under the BSD-style license found in the
7 * LICENSE file in the root directory of this source tree. An additional grant
8 * of patent rights can be found in the PATENTS file in the same directory.
9 */
10// @remove-on-eject-end
11
12'use strict';
13
14process.env.NODE_ENV = 'test';
15process.env.PUBLIC_URL = '';
16
17// Load environment variables from .env file. Suppress warnings using silent
18// if this file is missing. dotenv will never modify any environment variables
19// that have already been set.
20// https://github.com/motdotla/dotenv
21require('dotenv').config({silent: true});
22
23const jest = require('jest');
24const argv = process.argv.slice(2);
25
26// Watch unless on CI or in coverage mode
27if (!process.env.CI && argv.indexOf('--coverage') < 0) {
28 argv.push('--watch');
29}
30
31// @remove-on-eject-begin
32// This is not necessary after eject because we embed config into package.json.
33const createJestConfig = require('../utils/createJestConfig');
34const path = require('path');
35const paths = require('../config/paths');
36argv.push('--config', JSON.stringify(createJestConfig(
37 relativePath => path.resolve(__dirname, '..', relativePath),
38 path.resolve(paths.appSrc, '..'),
39 false
40)));
41// @remove-on-eject-end
42jest.run(argv);