Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix flaky test-worker-debug #28307

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions test/parallel/parallel.status
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ test-worker-memory: PASS,FLAKY
test-http2-client-upload: PASS,FLAKY
# https://github.com/nodejs/node/issues/20750
test-http2-client-upload-reject: PASS,FLAKY
# https://github.com/nodejs/node/issues/28106
test-worker-debug: PASS,FLAKY

[$system==linux]

Expand Down
10 changes: 8 additions & 2 deletions test/parallel/test-worker-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,17 @@ async function testWaitForDisconnectInWorker(session, post) {
});
await workerSession1.post('Runtime.runIfWaitingForDebugger');

// Create the promises before sending the exit message to the Worker in order
// to avoid race conditions.
const disconnectPromise =
waitForEvent(workerSession1, 'NodeRuntime.waitingForDisconnect');
const executionContextDestroyedPromise =
waitForEvent(workerSession2, 'Runtime.executionContextDestroyed');
worker.postMessage('resume');

await waitForEvent(workerSession1, 'NodeRuntime.waitingForDisconnect');
await disconnectPromise;
post('NodeWorker.detach', { sessionId: sessionId1 });
await waitForEvent(workerSession2, 'Runtime.executionContextDestroyed');
await executionContextDestroyedPromise;

await exitPromise;

Expand Down