Skip to content

Commit

Permalink
fixup! test: report error wpt test results
Browse files Browse the repository at this point in the history
  • Loading branch information
legendecas committed Oct 28, 2023
1 parent 111c759 commit 9e65978
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions test/common/wpt.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,13 @@ class WPTReport {

write() {
this.time_end = Date.now();
const results = Array.from(this.results.values()).filter((result) => {
return result.status === 'SKIP' || result.subtests.length !== 0;
}).map((result) => {
const url = new URL(result.test, 'http://wpt');
url.pathname = url.pathname.replace(/\.js$/, '.html');
result.test = url.href.slice(url.origin.length);
return result;
});
const results = Array.from(this.results.values())
.map((result) => {
const url = new URL(result.test, 'http://wpt');
url.pathname = url.pathname.replace(/\.js$/, '.html');
result.test = url.href.slice(url.origin.length);
return result;
});

/**
* Return required and some optional properties
Expand Down Expand Up @@ -687,6 +686,7 @@ class WPTRunner {
return;
}
// Generate a subtest failure for visibility.
// No need to record this synthetic failure with wpt.fyi.
this.fail(
spec,
{
Expand All @@ -696,7 +696,6 @@ class WPTRunner {
stack: inspect(err),
},
kUncaught,
reportResult,
);
// Mark the whole test as failed in wpt.fyi report.
reportResult?.finish('ERROR');
Expand All @@ -709,6 +708,7 @@ class WPTRunner {

process.on('exit', () => {
for (const spec of this.inProgress) {
// No need to record this synthetic failure with wpt.fyi.
this.fail(spec, { name: 'Incomplete' }, kIncomplete);
// Mark the whole test as failed in wpt.fyi report.
const reportResult = this.report?.getResult(spec);
Expand Down Expand Up @@ -834,7 +834,9 @@ class WPTRunner {

// Treat it like a test case failure
if (status === kTimeout) {
this.fail(spec, { name: 'WPT testharness timeout' }, kTimeout, reportResult);
// No need to record this synthetic failure with wpt.fyi.
this.fail(spec, { name: 'WPT testharness timeout' }, kTimeout);
// Mark the whole test as TIMEOUT in wpt.fyi report.
reportResult?.finish('TIMEOUT');
} else {
reportResult?.finish();
Expand Down

0 comments on commit 9e65978

Please sign in to comment.