Skip to content

Commit e1188d2

Browse files
panvajuanarbol
authored andcommitted
test: improve WPT report runner
Add incremental report writing after each spec completes and on worker errors so that reports survive if the process is killed before the exit handler runs. Add bytes() method to readAsFetch() to match the Response API used by newer WPT tests. PR-URL: #62107 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Mattias Buelens <mattias@buelens.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
1 parent d29b5c8 commit e1188d2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

‎test/common/wpt.js‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,7 @@ class ResourceLoader {
211211
return {
212212
ok: true,
213213
arrayBuffer() { return data.buffer; },
214+
bytes() { return new Uint8Array(data); },
214215
json() { return JSON.parse(data.toString()); },
215216
text() { return data.toString(); },
216217
};
@@ -706,6 +707,7 @@ class WPTRunner {
706707
// Mark the whole test as failed in wpt.fyi report.
707708
reportResult?.finish('ERROR');
708709
this.inProgress.delete(spec);
710+
this.report?.write();
709711
});
710712

711713
await events.once(worker, 'exit').catch(() => {});
@@ -772,6 +774,9 @@ class WPTRunner {
772774
}
773775
}
774776

777+
// Write the report on clean exit. The report is also written
778+
// incrementally after each spec completes (see completionCallback)
779+
// so that results survive if the process is killed.
775780
this.report?.write();
776781

777782
const ran = queue.length;
@@ -858,6 +863,9 @@ class WPTRunner {
858863
reportResult?.finish();
859864
}
860865
this.inProgress.delete(spec);
866+
// Write report incrementally so results survive even if the process
867+
// is killed before the exit handler runs.
868+
this.report?.write();
861869
// Always force termination of the worker. Some tests allocate resources
862870
// that would otherwise keep it alive.
863871
this.workers.get(spec).terminate();

0 commit comments

Comments
 (0)