@@ -3,8 +3,12 @@ import { expect, test } from 'vitest'
3
3
4
4
import { runVitest } from '../../test-utils'
5
5
6
- test ( 'match by partial pattern' , async ( ) => {
7
- const { stdout } = await runVitest ( { root : './fixtures' } , [ 'example' ] )
6
+ test . each ( [
7
+ { filter : 'example' } ,
8
+ { filter : '/example' } ,
9
+ { filter : resolve ( './fixtures/test/example' ) } ,
10
+ ] ) ( 'match by partial pattern $filter' , async ( { filter } ) => {
11
+ const { stdout } = await runVitest ( { root : './fixtures' } , [ filter ] )
8
12
9
13
expect ( stdout ) . toMatch ( '✓ test/example.test.ts > this will pass' )
10
14
expect ( stdout ) . toMatch ( 'Test Files 1 passed (1)' )
@@ -42,3 +46,41 @@ test.each([
42
46
expect ( stdout ) . toMatch ( '× test/dont-run-this.test.ts > this will fail' )
43
47
expect ( stdout ) . toMatch ( '✓ test/example.test.ts > this will pass' )
44
48
} )
49
+
50
+ test . each ( [
51
+ {
52
+ filter : 'basic' ,
53
+ files : [
54
+ 'test/basic.test.ts' ,
55
+ 'test/foo-basic/a.test.ts' ,
56
+ 'test/basic/a.test.ts' ,
57
+ 'test/basic-foo/a.test.ts' ,
58
+ ] ,
59
+ } ,
60
+ {
61
+ filter : '/basic' ,
62
+ files : [
63
+ 'test/basic.test.ts' ,
64
+ 'test/basic/a.test.ts' ,
65
+ 'test/basic-foo/a.test.ts' ,
66
+ ] ,
67
+ } ,
68
+ {
69
+ filter : 'basic/' ,
70
+ files : [
71
+ 'test/foo-basic/a.test.ts' ,
72
+ 'test/basic/a.test.ts' ,
73
+ ] ,
74
+ } ,
75
+ {
76
+ filter : '/basic/' ,
77
+ files : [
78
+ 'test/basic/a.test.ts' ,
79
+ ] ,
80
+ } ,
81
+ ] ) ( 'filter with slash $filter' , async ( { filter, files } ) => {
82
+ const { stdout } = await runVitest ( { root : './fixtures-slash' } , [ filter ] )
83
+ expect ( stdout ) . toMatch ( `Test Files ${ files . length } passed (${ files . length } )` )
84
+ for ( const file of files )
85
+ expect ( stdout ) . toMatch ( `✓ ${ file } ` )
86
+ } )
0 commit comments