@@ -26,6 +26,45 @@ test('threshold glob patterns count in global coverage', async () => {
26
26
} )
27
27
} )
28
28
29
+ test ( '{ thresholds: { 100: true } } on glob pattern' , async ( ) => {
30
+ const { stderr, exitCode } = await runVitest ( {
31
+ include : [ normalizeURL ( import . meta. url ) ] ,
32
+ coverage : {
33
+ include : [
34
+ '**/fixtures/src/even.ts' ,
35
+ '**/fixtures/src/math.ts' ,
36
+ ] ,
37
+ thresholds : {
38
+ '**/fixtures/src/even.ts' : {
39
+ 100 : true ,
40
+ } ,
41
+ '**/fixtures/src/math.ts' : {
42
+ 100 : true ,
43
+ } ,
44
+ } ,
45
+ } ,
46
+ } , { throwOnError : false } )
47
+
48
+ expect ( exitCode ) . toBe ( 1 )
49
+
50
+ if ( isV8Provider ( ) ) {
51
+ expect ( stderr ) . toMatchInlineSnapshot ( `
52
+ "ERROR: Coverage for lines (50%) does not meet "**/fixtures/src/math.ts" threshold (100%)
53
+ ERROR: Coverage for functions (25%) does not meet "**/fixtures/src/math.ts" threshold (100%)
54
+ ERROR: Coverage for statements (50%) does not meet "**/fixtures/src/math.ts" threshold (100%)
55
+ "
56
+ ` )
57
+ }
58
+ else {
59
+ expect ( stderr ) . toMatchInlineSnapshot ( `
60
+ "ERROR: Coverage for lines (25%) does not meet "**/fixtures/src/math.ts" threshold (100%)
61
+ ERROR: Coverage for functions (25%) does not meet "**/fixtures/src/math.ts" threshold (100%)
62
+ ERROR: Coverage for statements (25%) does not meet "**/fixtures/src/math.ts" threshold (100%)
63
+ "
64
+ ` )
65
+ }
66
+ } )
67
+
29
68
coverageTest ( 'cover some lines, but not too much' , ( ) => {
30
69
expect ( sum ( 1 , 2 ) ) . toBe ( 3 )
31
70
expect ( isEven ( 4 ) ) . toBe ( true )
0 commit comments