@@ -68,6 +68,8 @@ let modifiedFiles = {}
6868const quarantinedOrDisabledTestsAttemptToFix = [ ]
6969let quarantinedButNotAttemptToFixFqns = new Set ( )
7070let rootDir = ''
71+ let sessionProjects = [ ]
72+
7173const MINIMUM_SUPPORTED_VERSION_RANGE_EFD = '>=1.38.0' // TODO: remove this once we drop support for v5
7274
7375function isValidKnownTests ( receivedKnownTests ) {
@@ -495,6 +497,7 @@ function dispatcherHook (dispatcherExport) {
495497 const dispatcher = this
496498 const worker = createWorker . apply ( this , arguments )
497499 const projects = getProjectsFromDispatcher ( dispatcher )
500+ sessionProjects = projects
498501
499502 // for older versions of playwright, `shouldCreateTestSpan` should always be true,
500503 // since the `_runTest` function wrapper is not available for older versions
@@ -535,6 +538,7 @@ function dispatcherHookNew (dispatcherExport, runWrapper) {
535538 const dispatcher = this
536539 const worker = createWorker . apply ( this , arguments )
537540 const projects = getProjectsFromDispatcher ( dispatcher )
541+ sessionProjects = projects
538542
539543 worker . on ( 'testBegin' , ( { testId } ) => {
540544 const test = getTestByTestId ( dispatcher , testId )
@@ -1255,3 +1259,32 @@ addHook({
12551259
12561260 return workerPackage
12571261} )
1262+
1263+ addHook ( {
1264+ name : 'playwright' ,
1265+ file : 'lib/reporters/base.js' ,
1266+ versions : [ '>=1.38.0' ]
1267+ } , ( reportersPackage ) => {
1268+ // from https://github.com/microsoft/playwright/blob/bf92ffecff6f30a292b53430dbaee0207e0c61ad/packages/playwright/src/reporters/base.ts#L279
1269+ shimmer . wrap ( reportersPackage . TerminalReporter . prototype , 'generateSummary' , generateSummary => function ( ) {
1270+ const didNotRunTests = this . suite . allTests ( ) . filter ( test =>
1271+ test . outcome ( ) === 'skipped' && ( ! test . results . length || test . expectedStatus !== 'skipped' )
1272+ )
1273+ for ( const test of didNotRunTests ) {
1274+ const {
1275+ _requireFile : testSuiteAbsolutePath ,
1276+ location : { line : testSourceLine } ,
1277+ } = test
1278+ const browserName = getBrowserNameFromProjects ( sessionProjects , test )
1279+
1280+ testSkipCh . publish ( {
1281+ testName : getTestFullname ( test ) ,
1282+ testSuiteAbsolutePath,
1283+ testSourceLine,
1284+ browserName,
1285+ } )
1286+ }
1287+ return generateSummary . apply ( this , arguments )
1288+ } )
1289+ return reportersPackage
1290+ } )
0 commit comments