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 | ;
|
13 |
|
14 | process.env.NODE_ENV = 'test';
|
15 | process.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
|
21 | require('dotenv').config({silent: true});
|
22 |
|
23 | const jest = require('jest');
|
24 | const argv = process.argv.slice(2);
|
25 |
|
26 | // Watch unless on CI or in coverage mode
|
27 | if (!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.
|
33 | const createJestConfig = require('../utils/createJestConfig');
|
34 | const path = require('path');
|
35 | const paths = require('../config/paths');
|
36 | argv.push('--config', JSON.stringify(createJestConfig(
|
37 | relativePath => path.resolve(__dirname, '..', relativePath),
|
38 | path.resolve(paths.appSrc, '..'),
|
39 | false
|
40 | )));
|
41 | // @remove-on-eject-end
|
42 | jest.run(argv);
|