@@ -111,6 +111,8 @@ const efdDeterminedRetries = new Map()
111111const efdSlowAbortedTests = new Set ( )
112112// Tests added as EFD new-test candidates (not ATF, not impacted).
113113const efdNewTestCandidates = new Set ( )
114+ // Tests that are genuinely new (not in known tests list).
115+ const newTests = new Set ( )
114116const testSuiteAbsolutePathsWithFastCheck = new Set ( )
115117const testSuiteJestObjects = new Map ( )
116118
@@ -485,7 +487,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
485487 }
486488
487489 if ( this . isKnownTestsEnabled ) {
488- isNewTest = retriedTestsToNumAttempts . has ( testName )
490+ isNewTest = newTests . has ( testName )
489491 }
490492
491493 const willRunEfd = this . isEarlyFlakeDetectionEnabled && ( isNewTest || isModified )
@@ -605,6 +607,9 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
605607 }
606608 if ( ! isAttemptToFix && this . isKnownTestsEnabled ) {
607609 const isNew = ! this . knownTestsForThisSuite . includes ( testFullName )
610+ if ( isNew && ! isSkipped ) {
611+ newTests . add ( testFullName )
612+ }
608613 if ( isNew && ! isSkipped && ! retriedTestsToNumAttempts . has ( testFullName ) ) {
609614 if ( DYNAMIC_NAME_RE . test ( testFullName ) ) {
610615 // Populated directly for runInBand; for parallel workers the main process
@@ -715,7 +720,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
715720 let isEfdRetry = false
716721 // We'll store the test statuses of the retries
717722 if ( this . isKnownTestsEnabled ) {
718- const isNewTest = retriedTestsToNumAttempts . has ( testName )
723+ const isNewTest = newTests . has ( testName )
719724 if ( isNewTest ) {
720725 if ( newTestsTestStatuses . has ( testName ) ) {
721726 newTestsTestStatuses . get ( testName ) . push ( status )
@@ -811,6 +816,7 @@ function getWrappedEnvironment (BaseEnvironment, jestVersion) {
811816 efdDeterminedRetries . clear ( )
812817 efdSlowAbortedTests . clear ( )
813818 efdNewTestCandidates . clear ( )
819+ newTests . clear ( )
814820 retriedTestsToNumAttempts . clear ( )
815821 attemptToFixRetriedTestsStatuses . clear ( )
816822 testsToBeRetried . clear ( )
0 commit comments