Skip to content

Commit 84ae57e

Browse files
authored
fix(WPTs): flaky abort test (nodejs#1835)
1 parent 755fc4c commit 84ae57e

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

test/wpt/runner/runner/runner.mjs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,12 @@ export class WPTRunner extends EventEmitter {
112112
})
113113

114114
activeWorkers.add(worker)
115+
const timeout = setTimeout(
116+
() => {
117+
console.warn('Test timed out:', test)
118+
},
119+
meta.timeout === 'long' ? 60_000 : 10_000
120+
)
115121

116122
worker.on('message', (message) => {
117123
if (message.type === 'result') {
@@ -123,6 +129,7 @@ export class WPTRunner extends EventEmitter {
123129

124130
worker.once('exit', () => {
125131
activeWorkers.delete(worker)
132+
clearTimeout(timeout)
126133

127134
if (activeWorkers.size === 0) {
128135
this.handleRunnerCompletion()

test/wpt/server/server.mjs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,18 +115,19 @@ const server = createServer(async (req, res) => {
115115
while (true) {
116116
if (!res.write('.')) {
117117
break
118-
} else if (abortKey && stash.take(abortKey, fullUrl.pathname)) {
118+
} else if (abortKey && stash.take(abortKey)) {
119119
break
120120
}
121121

122-
await sleep(10)
122+
await sleep(100)
123123
}
124124

125125
if (stateKey) {
126126
stash.put(stateKey, 'closed', fullUrl.pathname)
127127
}
128128

129-
return res.end()
129+
res.end()
130+
return
130131
}
131132
case '/fetch/api/resources/stash-take.py': {
132133
// https://github.com/web-platform-tests/wpt/blob/6ae3f702a332e8399fab778c831db6b7dca3f1c6/fetch/api/resources/stash-take.py

test/wpt/status/fetch.status.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"general.any.js": {
3-
"fail": [
3+
"flaky": [
44
"Already aborted signal rejects immediately",
55
"Underlying connection is closed when aborting after receiving response - no-cors",
66
"Stream errors once aborted. Underlying connection closed."

0 commit comments

Comments
 (0)