@@ -34,13 +34,26 @@ export class Runner {
34
34
}
35
35
36
36
async listTestFiles ( projectNames : string [ ] | undefined ) : Promise < any > {
37
+ type ProjectConfigWithFiles = {
38
+ name : string ;
39
+ testDir : string ;
40
+ use : { testIdAttribute ?: string } ;
41
+ files : string [ ] ;
42
+ } ;
43
+
44
+ type ConfigListFilesReport = {
45
+ projects : ProjectConfigWithFiles [ ] ;
46
+ } ;
47
+
37
48
const projects = filterProjects ( this . _config . projects , projectNames ) ;
38
- const report : any = {
49
+ const report : ConfigListFilesReport = {
39
50
projects : [ ]
40
51
} ;
41
52
for ( const project of projects ) {
42
53
report . projects . push ( {
43
- ...sanitizeConfigForJSON ( project , new Set ( ) ) ,
54
+ name : project . project . name ,
55
+ testDir : project . project . testDir ,
56
+ use : { testIdAttribute : project . project . use . testIdAttribute } ,
44
57
files : await collectFilesForProject ( project )
45
58
} ) ;
46
59
}
@@ -99,32 +112,3 @@ export class Runner {
99
112
return await runUIMode ( config ) ;
100
113
}
101
114
}
102
-
103
- function sanitizeConfigForJSON ( object : any , visited : Set < any > ) : any {
104
- const type = typeof object ;
105
- if ( type === 'function' || type === 'symbol' )
106
- return undefined ;
107
- if ( ! object || type !== 'object' )
108
- return object ;
109
-
110
- if ( object instanceof RegExp )
111
- return String ( object ) ;
112
- if ( object instanceof Date )
113
- return object . toISOString ( ) ;
114
-
115
- if ( visited . has ( object ) )
116
- return undefined ;
117
- visited . add ( object ) ;
118
-
119
- if ( Array . isArray ( object ) )
120
- return object . map ( a => sanitizeConfigForJSON ( a , visited ) ) ;
121
-
122
- const result : any = { } ;
123
- const keys = Object . keys ( object ) . slice ( 0 , 100 ) ;
124
- for ( const key of keys ) {
125
- if ( key . startsWith ( '_' ) )
126
- continue ;
127
- result [ key ] = sanitizeConfigForJSON ( object [ key ] , visited ) ;
128
- }
129
- return result ;
130
- }
0 commit comments