UNPKG

1.33 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
12process.env.NODE_ENV = 'test';
13process.env.PUBLIC_URL = '';
14
15// Load environment variables from .env file. Suppress warnings using silent
16// if this file is missing. dotenv will never modify any environment variables
17// that have already been set.
18// https://github.com/motdotla/dotenv
19require('dotenv').config({silent: true});
20
21const jest = require('jest');
22const argv = process.argv.slice(2);
23
24// Watch unless on CI or in coverage mode
25if (!process.env.CI && argv.indexOf('--coverage') < 0) {
26 argv.push('--watch');
27}
28
29// @remove-on-eject-begin
30// This is not necessary after eject because we embed config into package.json.
31const createJestConfig = require('../utils/createJestConfig');
32const path = require('path');
33const paths = require('../config/paths');
34argv.push('--config', JSON.stringify(createJestConfig(
35 relativePath => path.resolve(__dirname, '..', relativePath),
36 path.resolve(paths.appSrc, '..'),
37 false
38)));
39// @remove-on-eject-end
40jest.run(argv);