@@ -2,6 +2,7 @@ import {TestRunStatus} from '../../constants/internal';
22
33import { assertValueIsFalse } from '../asserts' ;
44import { cloneWithoutLogEvents } from '../clone' ;
5+ import { writeGlobalError } from '../fs' ;
56
67import type { FullTestRun , TestFilePath } from '../../types/internal' ;
78
@@ -20,14 +21,22 @@ export const assertThatTestNamesAndFilePathsAreUniqueInOneRetry = (
2021 for ( const fullTestRun of unbrokenTestRuns ) {
2122 const { filePath, name} = fullTestRun ;
2223
23- assertValueIsFalse (
24- filePath in filePathsHash ,
25- 'filePath is unique: each test should be in a separate file' ,
26- {
27- firstFullTestRun : cloneWithoutLogEvents ( filePathsHash [ filePath ] as FullTestRun ) ,
28- secondFullTestRun : cloneWithoutLogEvents ( fullTestRun ) ,
29- } ,
30- ) ;
24+ if ( filePath in filePathsHash ) {
25+ const firstTestString = JSON . stringify ( {
26+ name : ( filePathsHash [ filePath ] as FullTestRun ) . name ,
27+ options : filePathsHash [ filePath ] ?. options ,
28+ } ) ;
29+
30+ const secondTestString = JSON . stringify ( {
31+ name : fullTestRun . name ,
32+ options : fullTestRun . options ,
33+ } ) ;
34+
35+ void writeGlobalError (
36+ `There are duplicate tests in one filePath (${ filePath } ): ${ firstTestString } , ${ secondTestString } ` ,
37+ ) ;
38+ }
39+
3140 assertValueIsFalse ( name in namesHash , 'name is unique: each test must have a unique name' , {
3241 firstFullTestRun : cloneWithoutLogEvents ( namesHash [ name ] as FullTestRun ) ,
3342 secondFullTestRun : cloneWithoutLogEvents ( fullTestRun ) ,
0 commit comments