@@ -234,6 +234,81 @@ test('coverage provider v8 works correctly in workspaced browser mode if instanc
234
234
] )
235
235
} )
236
236
237
+ test ( 'browser instances with include/exclude/includeSource option override parent that patterns' , async ( ) => {
238
+ const { projects } = await vitest ( { } , {
239
+ include : [ '**/*.global.test.{js,ts}' , '**/*.shared.test.{js,ts}' ] ,
240
+ exclude : [ '**/*.skip.test.{js,ts}' ] ,
241
+ includeSource : [ 'src/**/*.{js,ts}' ] ,
242
+ browser : {
243
+ enabled : true ,
244
+ headless : true ,
245
+ instances : [
246
+ { browser : 'chromium' } ,
247
+ { browser : 'firefox' , include : [ 'test/firefox-specific.test.ts' ] , exclude : [ 'test/webkit-only.test.ts' , 'test/webkit-extra.test.ts' ] , includeSource : [ 'src/firefox-compat.ts' ] } ,
248
+ { browser : 'webkit' , include : [ 'test/webkit-only.test.ts' , 'test/webkit-extra.test.ts' ] , exclude : [ 'test/firefox-specific.test.ts' ] , includeSource : [ 'src/webkit-compat.ts' ] } ,
249
+ ] ,
250
+ } ,
251
+ } )
252
+
253
+ // Chromium should inherit parent include/exclude/includeSource patterns (plus default test pattern)
254
+ expect ( projects [ 0 ] . name ) . toEqual ( 'chromium' )
255
+ expect ( projects [ 0 ] . config . include ) . toEqual ( [
256
+ 'test/**.test.ts' ,
257
+ '**/*.global.test.{js,ts}' ,
258
+ '**/*.shared.test.{js,ts}' ,
259
+ ] )
260
+ expect ( projects [ 0 ] . config . exclude ) . toEqual ( [
261
+ '**/*.skip.test.{js,ts}' ,
262
+ ] )
263
+ expect ( projects [ 0 ] . config . includeSource ) . toEqual ( [
264
+ 'src/**/*.{js,ts}' ,
265
+ ] )
266
+
267
+ // Firefox should only have its specific include/exclude/includeSource pattern (not parent patterns)
268
+ expect ( projects [ 1 ] . name ) . toEqual ( 'firefox' )
269
+ expect ( projects [ 1 ] . config . include ) . toEqual ( [
270
+ 'test/firefox-specific.test.ts' ,
271
+ ] )
272
+ expect ( projects [ 1 ] . config . exclude ) . toEqual ( [
273
+ 'test/webkit-only.test.ts' ,
274
+ 'test/webkit-extra.test.ts' ,
275
+ ] )
276
+ expect ( projects [ 1 ] . config . includeSource ) . toEqual ( [
277
+ 'src/firefox-compat.ts' ,
278
+ ] )
279
+
280
+ // Webkit should only have its specific include/exclude/includeSource patterns (not parent patterns)
281
+ expect ( projects [ 2 ] . name ) . toEqual ( 'webkit' )
282
+ expect ( projects [ 2 ] . config . include ) . toEqual ( [
283
+ 'test/webkit-only.test.ts' ,
284
+ 'test/webkit-extra.test.ts' ,
285
+ ] )
286
+ expect ( projects [ 2 ] . config . exclude ) . toEqual ( [
287
+ 'test/firefox-specific.test.ts' ,
288
+ ] )
289
+ expect ( projects [ 2 ] . config . includeSource ) . toEqual ( [
290
+ 'src/webkit-compat.ts' ,
291
+ ] )
292
+ } )
293
+
294
+ test ( 'browser instances with empty include array should get parent include patterns' , async ( ) => {
295
+ const { projects } = await vitest ( { } , {
296
+ include : [ '**/*.test.{js,ts}' ] ,
297
+ browser : {
298
+ enabled : true ,
299
+ headless : true ,
300
+ instances : [
301
+ { browser : 'chromium' , include : [ ] } ,
302
+ { browser : 'firefox' } ,
303
+ ] ,
304
+ } ,
305
+ } )
306
+
307
+ // Both instances should inherit parent include patterns when include is empty or not specified
308
+ expect ( projects [ 0 ] . config . include ) . toEqual ( [ 'test/**.test.ts' , '**/*.test.{js,ts}' ] )
309
+ expect ( projects [ 1 ] . config . include ) . toEqual ( [ 'test/**.test.ts' , '**/*.test.{js,ts}' ] )
310
+ } )
311
+
237
312
test ( 'filter for the global browser project includes all browser instances' , async ( ) => {
238
313
const { projects } = await vitest ( { project : 'myproject' } , {
239
314
projects : [
0 commit comments