File tree Expand file tree Collapse file tree 5 files changed +289
-102
lines changed
packages/@vue/cli-plugin-unit-jest Expand file tree Collapse file tree 5 files changed +289
-102
lines changed Original file line number Diff line number Diff line change 4949 "eslint-plugin-vue-libs" : " ^2.1.0" ,
5050 "globby" : " ^8.0.1" ,
5151 "http-server" : " ^0.11.1" ,
52- "jest" : " ^22 .1.4 " ,
52+ "jest" : " ^23 .1.0 " ,
5353 "lerna" : " ^2.8.0" ,
5454 "lint-staged" : " ^6.0.1" ,
5555 "memfs" : " ^2.8.0" ,
Original file line number Diff line number Diff line change @@ -7,7 +7,12 @@ test('base', async () => {
77 apply : require ( '../generator' ) ,
88 options : { }
99 } ,
10- // mock presence of the eslint plugin
10+ // mock presence of the babel & eslint plugin
11+ {
12+ id : 'babel' ,
13+ apply : ( ) => { } ,
14+ options : { }
15+ } ,
1116 {
1217 id : 'eslint' ,
1318 apply : ( ) => { } ,
@@ -17,9 +22,27 @@ test('base', async () => {
1722
1823 expect ( pkg . scripts [ 'test:unit' ] ) . toBe ( 'vue-cli-service test:unit' )
1924 expect ( pkg . devDependencies ) . toHaveProperty ( '@vue/test-utils' )
25+
26+ // should inject babel-jest
2027 expect ( pkg . devDependencies ) . toHaveProperty ( 'babel-jest' )
28+ // babel-core 6 -> 7 shim
29+ expect ( pkg . devDependencies ) . toHaveProperty ( 'babel-core' )
30+ // eslint
2131 expect ( files [ 'tests/unit/.eslintrc.js' ] ) . toMatch ( 'jest: true' )
2232
2333 const spec = files [ 'tests/unit/HelloWorld.spec.js' ]
2434 expect ( spec ) . toMatch ( `expect(wrapper.text()).toMatch(msg)` )
2535} )
36+
37+ test ( 'without babel/eslint' , async ( ) => {
38+ const { pkg, files } = await generateWithPlugin ( [
39+ {
40+ id : 'unit-jest' ,
41+ apply : require ( '../generator' ) ,
42+ options : { }
43+ }
44+ ] )
45+
46+ expect ( pkg . devDependencies ) . not . toHaveProperty ( 'babel-jest' )
47+ expect ( files [ 'tests/unit/.eslintrc.js' ] ) . toBeUndefined ( )
48+ } )
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ module.exports = api => {
4040 jestConfig . transform [ '^.+\\.jsx?$' ] = 'babel-jest'
4141 api . extendPackage ( {
4242 devDependencies : {
43- 'babel-jest' : '^22.4.3 ' ,
43+ 'babel-jest' : '^23.0.1 ' ,
4444 // this is for now necessary to force babel-jest and vue-jest to use babel 7
4545 'babel-core' : '7.0.0-bridge.0'
4646 }
Original file line number Diff line number Diff line change 2323 },
2424 "dependencies" : {
2525 "@vue/cli-shared-utils" : " ^3.0.0-beta.15" ,
26- "jest" : " ^22.4.3 " ,
26+ "jest" : " ^23.1.0 " ,
2727 "jest-serializer-vue" : " ^1.0.0" ,
2828 "jest-transform-stub" : " ^1.0.0" ,
2929 "vue-jest" : " ^2.6.0"
3030 },
3131 "devDependencies" : {
3232 "@vue/test-utils" : " ^1.0.0-beta.16" ,
33- "babel-jest" : " ^22.4.3 " ,
33+ "babel-jest" : " ^23.0.1 " ,
3434 "ts-jest" : " ^22.4.6"
3535 }
3636}
You can’t perform that action at this time.
0 commit comments