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_runner: ensure proper teardown when tests run without isolation #57394

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pmarchini
Copy link
Member

This should address #57234.

Adding the teardown in case of isolation: none addresses this specific issue, and I see no potential negative effects in having it.

@cjihrig, was there a reason why we avoided it in the first place?

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

Sorry, something went wrong.

@pmarchini pmarchini requested a review from cjihrig March 9, 2025 22:49
@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem. labels Mar 9, 2025
Copy link

codecov bot commented Mar 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.23%. Comparing base (9df0ff7) to head (dd7af59).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #57394      +/-   ##
==========================================
- Coverage   90.23%   90.23%   -0.01%     
==========================================
  Files         630      630              
  Lines      185200   185214      +14     
  Branches    36233    36243      +10     
==========================================
+ Hits       167108   167120      +12     
- Misses      11056    11057       +1     
- Partials     7036     7037       +1     
Files with missing lines Coverage Δ
lib/internal/test_runner/runner.js 89.52% <100.00%> (+0.01%) ⬆️

... and 22 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pmarchini
Copy link
Member Author

These changes have broken the following test:

{
const child = spawnSync(process.execPath, [
'--test',
'--test-isolation=none',
fixtures.path('test-runner', 'async-error-in-test-hook.mjs'),
]);
const stdout = child.stdout.toString();
assert.match(stdout, /Error: Test hook "before" at .+async-error-in-test-hook\.mjs:3:1 generated asynchronous activity after the test ended/m);
assert.match(stdout, /Error: Test hook "beforeEach" at .+async-error-in-test-hook\.mjs:9:1 generated asynchronous activity after the test ended/m);
assert.match(stdout, /Error: Test hook "after" at .+async-error-in-test-hook\.mjs:15:1 generated asynchronous activity after the test ended/m);
assert.match(stdout, /Error: Test hook "afterEach" at .+async-error-in-test-hook\.mjs:21:1 generated asynchronous activity after the test ended/m);
assert.match(stdout, /pass 1$/m);
assert.match(stdout, /fail 0$/m);
assert.match(stdout, /cancelled 0$/m);
assert.strictEqual(child.status, 1);
assert.strictEqual(child.signal, null);
}

I'm taking a look!

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants