Skip to content

Fix flaky --exit integration timeout by avoiding a hard-coded port - #6364

Draft
mark-wiemer with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-flaky-test-root-suite-exit
Draft

mark-wiemer with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-flaky-test-root-suite-exit

Conversation

Copilot AI commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

The --exit integration spec was intermittently failing because the test fixture bound a fixed local port. Under CI and busy environments, that can collide with other listeners or stale processes and make the “should hang when --no-exit is used” case fail even though the root suite behavior is correct.

  • Changed the exit fixture to bind to an ephemeral port instead of a fixed port:
    • server.listen(0, done);
  • This preserves the intended regression coverage: the test still verifies that Mocha does not force exit after the root suite completes when --no-exit behavior is in effect, without depending on a port that may already be in use.
it('should hang when --no-exit used', function (done) {
  var server = net.createServer();
  server.listen(0, done);
});

This keeps the test focused on the actual behavior under test and removes the flaky dependency on local port availability.

@linux-foundation-easycla

linux-foundation-easycla Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

CLA Not Signed

Co-authored-by: mark-wiemer <7833360+mark-wiemer@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix flaky test: ensure exit does not happen after root suite completion Fix flaky --exit integration timeout by avoiding a hard-coded port Sep 19, 2026
Copilot AI requested a review from mark-wiemer September 19, 2026 17:44

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🛠️ Repo: flaky test: "--exit ... should not force exit after root suite completion"

2 participants