7
7
* of patent rights can be found in the PATENTS file in the same directory.
8
8
*/
9
9
10
+ var createJestConfig = require ( './utils/create-jest-config' ) ;
10
11
var fs = require ( 'fs' ) ;
11
12
var path = require ( 'path' ) ;
13
+ var prompt = require ( './utils/prompt' ) ;
12
14
var rimrafSync = require ( 'rimraf' ) . sync ;
13
15
var spawnSync = require ( 'cross-spawn' ) . sync ;
14
- var prompt = require ( './utils/prompt' ) ;
15
16
16
17
prompt (
17
18
'Are you sure you want to eject? This action is permanent.' ,
@@ -37,6 +38,9 @@ prompt(
37
38
path . join ( 'config' , 'polyfills.js' ) ,
38
39
path . join ( 'config' , 'webpack.config.dev.js' ) ,
39
40
path . join ( 'config' , 'webpack.config.prod.js' ) ,
41
+ path . join ( 'config' , 'jest' , 'CSSStub.js' ) ,
42
+ path . join ( 'config' , 'jest' , 'FileStub.js' ) ,
43
+ path . join ( 'config' , 'jest' , 'transform.js' ) ,
40
44
path . join ( 'scripts' , 'build.js' ) ,
41
45
path . join ( 'scripts' , 'start.js' ) ,
42
46
path . join ( 'scripts' , 'utils' , 'chrome.applescript' ) ,
@@ -59,6 +63,7 @@ prompt(
59
63
// Copy the files over
60
64
fs . mkdirSync ( path . join ( appPath , 'config' ) ) ;
61
65
fs . mkdirSync ( path . join ( appPath , 'config' , 'flow' ) ) ;
66
+ fs . mkdirSync ( path . join ( appPath , 'config' , 'jest' ) ) ;
62
67
fs . mkdirSync ( path . join ( appPath , 'scripts' ) ) ;
63
68
fs . mkdirSync ( path . join ( appPath , 'scripts' , 'utils' ) ) ;
64
69
@@ -96,6 +101,11 @@ prompt(
96
101
} ) ;
97
102
delete appPackage . scripts [ 'eject' ] ;
98
103
104
+ appPackage . scripts . test = 'jest' ;
105
+ appPackage . jest = createJestConfig (
106
+ filePath => path . join ( '<rootDir>' , filePath )
107
+ ) ;
108
+
99
109
// explicitly specify ESLint config path for editor plugins
100
110
appPackage . eslintConfig = {
101
111
extends : './config/eslint.js' ,
0 commit comments