@@ -243,6 +243,33 @@ test('viewport', async () => {
243243 } )
244244} )
245245
246+ test ( 'in-source tests don\'t run when the module is imported by the test' , async ( ) => {
247+ const { stderr, stdout } = await runBrowserTests ( { } , [ 'mocking.test.ts' ] )
248+ expect ( stderr ) . toBe ( '' )
249+
250+ instances . forEach ( ( { browser } ) => {
251+ expect ( stdout ) . toReportPassedTest ( 'test/mocking.test.ts' , browser )
252+ } )
253+
254+ // there is only one file with one test inside
255+ // if this stops working, it will report twice as much tests
256+ expect ( stdout ) . toContain ( `Test Files ${ instances . length } passed` )
257+ expect ( stdout ) . toContain ( `Tests ${ instances . length } passed` )
258+ } )
259+
260+ test ( 'in-source tests run correctly when filtered' , async ( ) => {
261+ const { stderr, stdout } = await runBrowserTests ( { } , [ 'actions.ts' ] )
262+ expect ( stderr ) . toBe ( '' )
263+
264+ instances . forEach ( ( { browser } ) => {
265+ expect ( stdout ) . toReportPassedTest ( 'src/actions.ts' , browser )
266+ } )
267+
268+ // there is only one file with one test inside
269+ expect ( stdout ) . toContain ( `Test Files ${ instances . length } passed` )
270+ expect ( stdout ) . toContain ( `Tests ${ instances . length } passed` )
271+ } )
272+
246273test . runIf ( provider === 'playwright' ) ( 'timeout hooks' , async ( ) => {
247274 const { stderr } = await runBrowserTests ( {
248275 root : './fixtures/timeout-hooks' ,
0 commit comments