File tree Expand file tree Collapse file tree 2 files changed +23
-1
lines changed
packages/@vue/cli-plugin-unit-jest Expand file tree Collapse file tree 2 files changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -11,3 +11,25 @@ test('should work', async () => {
11
11
} )
12
12
await project . run ( `vue-cli-service test` )
13
13
} )
14
+
15
+ test ( 'should respect jest testMatch config' , async ( ) => {
16
+ const project = await create ( 'unit-jest' , {
17
+ plugins : {
18
+ '@vue/cli-plugin-babel' : { } ,
19
+ '@vue/cli-plugin-unit-jest' : { }
20
+ }
21
+ } )
22
+ const config = JSON . parse ( await project . read ( 'package.json' ) )
23
+ config . jest . testMatch = [ 'custom-test-directory/my.spec.js' ]
24
+
25
+ await project . write ( 'package.json' , JSON . stringify ( config ) )
26
+
27
+ let result
28
+ try {
29
+ await project . run ( `vue-cli-service test` )
30
+ } catch ( e ) {
31
+ result = e
32
+ }
33
+ console . log ( result )
34
+ expect ( result . stdout ) . toMatch ( 'custom-test-directory/my.spec.js' )
35
+ } )
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ module.exports = api => {
18
18
const jestBinPath = require . resolve ( 'jest/bin/jest' )
19
19
20
20
let testMatch = [ ]
21
- if ( ! args . _ . length ) {
21
+ if ( ! args . _ . length && ! api . service . pkg . jest . testMatch ) {
22
22
testMatch = [ `--testMatch` , `<rootDir>/(tests/unit/**/*.spec.(ts|tsx|js)|**/__tests__/*.(ts|tsx|js))` ]
23
23
}
24
24
You can’t perform that action at this time.
0 commit comments