@@ -2287,3 +2287,42 @@ test('shard chart', async ({ runInlineTest, writeFiles, showReport, page, mergeR
22872287 - listitem /@mac/
22882288 ` ) ;
22892289} ) ;
2290+
2291+ test ( 'should populate projects in config when merging reports' , async ( { runInlineTest, mergeReports } ) => {
2292+ const reportDir = test . info ( ) . outputPath ( 'blob-report' ) ;
2293+ class CustomReporter {
2294+ onBegin ( config , suite ) {
2295+ const projectNames = config . projects . map ( p => p . name ) ;
2296+ console . log ( '%%' + JSON . stringify ( projectNames ) ) ;
2297+ }
2298+ }
2299+ const files = {
2300+ 'reporter.js' : `module.exports = ${ CustomReporter . toString ( ) } ;` ,
2301+ 'playwright.config.ts' : `
2302+ module.exports = {
2303+ reporter: [['blob', { outputDir: '${ reportDir . replace ( / \\ / g, '/' ) } ' }]],
2304+ projects: [
2305+ { name: 'setup' },
2306+ { name: 'p1', dependencies: ['setup'] },
2307+ { name: 'p2', dependencies: ['setup'] },
2308+ ]
2309+ };
2310+ ` ,
2311+ 'a.test.js' : `
2312+ import { test } from '@playwright/test';
2313+ test('test 1', async ({}) => {});
2314+ ` ,
2315+ } ;
2316+
2317+ await runInlineTest ( files , { shard : `1/2` , workers : 1 } ) ;
2318+ await runInlineTest ( files , { shard : `2/2` , workers : 1 } , { PWTEST_BLOB_DO_NOT_REMOVE : '1' } ) ;
2319+
2320+ const reportFiles = await fs . promises . readdir ( reportDir ) ;
2321+ expect ( reportFiles ) . toHaveLength ( 2 ) ;
2322+
2323+ const { exitCode, outputLines } = await mergeReports ( reportDir , { } , { additionalArgs : [ '--reporter' , test . info ( ) . outputPath ( 'reporter.js' ) ] } ) ;
2324+ expect ( exitCode ) . toBe ( 0 ) ;
2325+
2326+ const projectNames = JSON . parse ( outputLines [ 0 ] ) ;
2327+ expect ( projectNames ) . toEqual ( [ 'setup' , 'p1' , 'setup' , 'p2' ] ) ;
2328+ } ) ;
0 commit comments