@@ -37,6 +37,7 @@ export type TestReportMetadata = {
37
37
runId : string | null ;
38
38
total : number ;
39
39
pass : number ;
40
+ ignore : number ;
40
41
} ;
41
42
42
43
// The test report format, which is stored in JSON file
@@ -67,6 +68,10 @@ const NODE_IGNORED_TEST_DIRS = [
67
68
"wpt" ,
68
69
] ;
69
70
71
+ const NODE_IGNORED_TEST_CASES = new Set ( [
72
+ "parallel/test-benchmark-cli.js" , // testing private benchmark utility
73
+ ] ) ;
74
+
70
75
/** The group is the directory name of the test file.
71
76
* e.g. parallel, internet, pummel, sequential, pseudo-tty, etc */
72
77
function getGroupRelUrl ( str : string ) {
@@ -84,7 +89,8 @@ function truncateTestOutput(output: string): string {
84
89
enum NodeTestFileResult {
85
90
PASS = "pass" ,
86
91
FAIL = "fail" ,
87
- SKIP = "skip" ,
92
+ SKIP = "skip" , // skipped because of filtering (for debugging locally)
93
+ IGNORED = "ignored" , // ignored because the test case does not need to pass in Deno
88
94
}
89
95
90
96
interface NodeTestFileReport {
@@ -95,7 +101,7 @@ interface NodeTestFileReport {
95
101
type TestReports = Record < string , NodeTestFileReport > ;
96
102
97
103
export type SingleResult = [
98
- pass : boolean ,
104
+ pass : boolean | "IGNORE" ,
99
105
error ?: ErrorExit | ErrorTimeout | ErrorUnexpected ,
100
106
] ;
101
107
type ErrorExit = {
@@ -136,6 +142,9 @@ async function runSingle(
136
142
testPath : string ,
137
143
retry = 0 ,
138
144
) : Promise < NodeTestFileReport > {
145
+ if ( NODE_IGNORED_TEST_CASES . has ( testPath ) ) {
146
+ return { result : NodeTestFileResult . IGNORED } ;
147
+ }
139
148
let cmd : Deno . ChildProcess | undefined ;
140
149
const testPath_ = "tests/node_compat/runner/suite/test/" + testPath ;
141
150
try {
@@ -203,6 +212,8 @@ function transformReportsIntoResults(
203
212
let result : SingleResult = [ true ] ;
204
213
if ( value . result === NodeTestFileResult . FAIL ) {
205
214
result = [ false , value . error ] ;
215
+ } else if ( value . result === NodeTestFileResult . IGNORED ) {
216
+ result = [ "IGNORE" ] ;
206
217
}
207
218
results [ key ] = result ;
208
219
}
@@ -214,6 +225,7 @@ async function writeTestReport(
214
225
reports : TestReports ,
215
226
total : number ,
216
227
pass : number ,
228
+ ignore : number ,
217
229
) {
218
230
// First transform the results - before we added `NodeTestFileReport` we used `SingleResult`.
219
231
// For now we opt to keep that format, as migrating existing results is cumbersome.
@@ -231,6 +243,7 @@ async function writeTestReport(
231
243
runId : Deno . env . get ( "GITHUB_RUN_ID" ) ?? null ,
232
244
total,
233
245
pass,
246
+ ignore,
234
247
results,
235
248
} satisfies TestReport ,
236
249
) ,
@@ -270,6 +283,8 @@ async function main() {
270
283
console . log ( `${ num } %cPASS` , "color: green" , testPath ) ;
271
284
} else if ( result . result === NodeTestFileResult . FAIL ) {
272
285
console . log ( `${ num } %cFAIL` , "color: red" , testPath ) ;
286
+ } else if ( result . result === NodeTestFileResult . IGNORED ) {
287
+ console . log ( `${ num } %cIGNORED` , "color: gray" , testPath ) ;
273
288
} else {
274
289
// Don't print message for "skip" for now, as it's too noisy
275
290
// console.log(`${num} %cSKIP`, "color: yellow", testPath);
@@ -339,6 +354,10 @@ async function main() {
339
354
// console.log(` %cSKIP`, "color: yellow", testPath);
340
355
break ;
341
356
}
357
+ case NodeTestFileResult . IGNORED : {
358
+ console . log ( ` %cIGNORED` , "color: gray" , testPath ) ;
359
+ break ;
360
+ }
342
361
default :
343
362
console . warn (
344
363
`Unknown result (${ fileResult . result } ) for ${ testPath } ` ,
@@ -347,19 +366,21 @@ async function main() {
347
366
}
348
367
349
368
// Summary
350
- let total ;
351
369
const pass =
352
370
tests . filter ( ( test ) => reports [ test ] . result === NodeTestFileResult . PASS )
353
371
. length ;
372
+ const fail =
373
+ tests . filter ( ( test ) => reports [ test ] . result === NodeTestFileResult . FAIL )
374
+ . length ;
375
+ const ignore =
376
+ tests . filter ( ( test ) => reports [ test ] . result === NodeTestFileResult . IGNORED )
377
+ . length ;
378
+ const total = pass + fail ;
354
379
if ( filterTerm ) {
355
- total = tests . map ( ( testPath ) =>
356
- reports [ testPath ] . result
357
- ) . filter ( ( result ) => result !== NodeTestFileResult . SKIP ) . length ;
358
380
console . log (
359
381
`Filtered tests: ${ pass } /${ total } (${ ( pass / total * 100 ) . toFixed ( 2 ) } %)` ,
360
382
) ;
361
383
} else {
362
- total = tests . length ;
363
384
console . log (
364
385
`All tests: ${ pass } /${ total } (${ ( pass / total * 100 ) . toFixed ( 2 ) } %)` ,
365
386
) ;
@@ -369,7 +390,7 @@ async function main() {
369
390
// Store the results in a JSON file
370
391
371
392
if ( ! filterTerm ) {
372
- await writeTestReport ( reports , total , pass ) ;
393
+ await writeTestReport ( reports , total , pass , ignore ) ;
373
394
}
374
395
375
396
Deno . exit ( 0 ) ;
0 commit comments