Skip to content

Commit 65407f9

Browse files
committed
fixup! test: add opt-in process WPT runner
1 parent 5c8d100 commit 65407f9

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

test/parallel/test-common-wpt-backends.js

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,17 @@ async function collect(backend, throws) {
7777
}
7878

7979
async function compare(throws) {
80-
// Compared as a set: an uncaught error reaches the runner over a different
81-
// channel than the results do, so it can overtake them on the thread
82-
// backend. The runner acts on each of these independently.
83-
const thread = (await collect('thread', throws)).sort();
84-
const child = (await collect('process', throws)).sort();
80+
const comparable = async (backend) => {
81+
const events = await collect(backend, throws);
82+
// A worker thread keeps delivering messages after it throws, so `events`
83+
// is copied here and only the error is compared; what the spec reports
84+
// before throwing is covered by the run that completes normally.
85+
const wanted = throws ? (event) => event.startsWith('uncaught ') : () => true;
86+
return events.filter(wanted).sort();
87+
};
88+
89+
const thread = await comparable('thread');
90+
const child = await comparable('process');
8591
assert.notStrictEqual(thread.length, 0);
8692
assert.deepStrictEqual(thread, child);
8793
return thread;
@@ -112,10 +118,9 @@ async function main() {
112118
]);
113119

114120
const uncaught = await compare(true);
115-
assert.ok(
116-
uncaught.includes('uncaught Error: deliberate uncaught error | deliberate uncaught error'),
117-
`uncaught error was not reported: ${uncaught.join(', ')}`,
118-
);
121+
assert.deepStrictEqual(uncaught, [
122+
'uncaught Error: deliberate uncaught error | deliberate uncaught error',
123+
]);
119124

120125
for (const [driver, spec] of [
121126
['test-compression.js', 'compression-bad-chunks.any.js'],

0 commit comments

Comments
 (0)