File tree 4 files changed +21
-5
lines changed
cli-plugin-typescript/generator/template
4 files changed +21
-5
lines changed Original file line number Diff line number Diff line change 8
8
"experimentalDecorators" : true ,
9
9
"emitDecoratorMetadata" : true ,
10
10
<%_ } _%>
11
+ <%_ if (hasJest) { _%>
12
+ "allowSyntheticDefaultImports" : true ,
13
+ <%_ } _%>
11
14
" sourceMap" : true ,
12
15
"baseUrl" : " ." ,
13
16
"paths" : {
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ module.exports = api => {
11
11
12
12
const jestConfig = {
13
13
'moduleFileExtensions' : [
14
+ 'js' ,
15
+ 'jsx' ,
14
16
'json' ,
15
17
// tell Jest to handle *.vue files
16
18
'vue'
@@ -31,7 +33,6 @@ module.exports = api => {
31
33
}
32
34
33
35
if ( ! api . hasPlugin ( 'typescript' ) ) {
34
- jestConfig . moduleFileExtensions . unshift ( 'js' , 'jsx' )
35
36
jestConfig . transform [ '^.+\\.jsx?$' ] = 'babel-jest'
36
37
api . extendPackage ( {
37
38
devDependencies : {
Original file line number Diff line number Diff line change @@ -18,8 +18,21 @@ module.exports = api => {
18
18
const execa = require ( 'execa' )
19
19
const jestBinPath = require . resolve ( 'jest/bin/jest' )
20
20
21
+ let testMatch = [ ]
22
+ if ( ! args . _ . length && api . hasPlugin ( 'typescript' ) ) {
23
+ testMatch = [ `--testMatch` , `<rootDir>/**/*.spec.(ts|tsx|js)` ]
24
+ }
25
+
26
+ const argv = [
27
+ ...rawArgv ,
28
+ ...testMatch
29
+ ]
30
+
21
31
return new Promise ( ( resolve , reject ) => {
22
- const child = execa ( jestBinPath , rawArgv , { stdio : 'inherit' } )
32
+ const child = execa ( jestBinPath , argv , {
33
+ cwd : api . resolve ( '.' ) ,
34
+ stdio : 'inherit'
35
+ } )
23
36
child . on ( 'error' , reject )
24
37
child . on ( 'exit' , code => {
25
38
if ( code !== 0 ) {
Original file line number Diff line number Diff line change @@ -18,10 +18,9 @@ module.exports = cli => {
18
18
short : 'Mocha'
19
19
} ,
20
20
{
21
- name : 'Jest (WIP) ' ,
21
+ name : 'Jest' ,
22
22
value : 'jest' ,
23
- short : 'Jest' ,
24
- disabled : true
23
+ short : 'Jest'
25
24
}
26
25
]
27
26
} )
You can’t perform that action at this time.
0 commit comments