@@ -26,6 +26,45 @@ test('threshold glob patterns count in global coverage', async () => {
2626 } )
2727} )
2828
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+
2968coverageTest ( 'cover some lines, but not too much' , ( ) => {
3069 expect ( sum ( 1 , 2 ) ) . toBe ( 3 )
3170 expect ( isEven ( 4 ) ) . toBe ( true )
0 commit comments