Skip to content

test_runner: pass setup context to global teardown#61726

Open
Han5991 wants to merge 1 commit intonodejs:mainfrom
Han5991:test-runner-global-hook-context
Open

test_runner: pass setup context to global teardown#61726
Han5991 wants to merge 1 commit intonodejs:mainfrom
Han5991:test-runner-global-hook-context

Conversation

@Han5991
Copy link
Contributor

@Han5991 Han5991 commented Feb 7, 2026

Summary

  • pass the return value of globalSetup() into globalTeardown(context) in the test runner harness
  • replace the context-sharing TODOs with concrete coverage in both node:test.run and CLI global hook suites
  • document that globalSetup return values are provided to globalTeardown

Testing

  • python3 tools/test.py test/parallel/test-runner-run-global-hooks.mjs test/parallel/test-runner-global-setup-teardown.mjs

@nodejs-github-bot
Copy link
Collaborator

Review requested:

  • @nodejs/test_runner

@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 Feb 7, 2026
Allow globalSetup() to return data consumed by globalTeardown().

Resolve the context-sharing TODO and document this behavior.
@Han5991 Han5991 force-pushed the test-runner-global-hook-context branch from 317cf15 to e9d71b4 Compare February 7, 2026 23:47
@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.74%. Comparing base (c2a0353) to head (e9d71b4).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #61726   +/-   ##
=======================================
  Coverage   89.73%   89.74%           
=======================================
  Files         675      675           
  Lines      204525   204527    +2     
  Branches    39308    39305    -3     
=======================================
+ Hits       183531   183545   +14     
+ Misses      13285    13248   -37     
- Partials     7709     7734   +25     
Files with missing lines Coverage Δ
lib/internal/test_runner/harness.js 91.86% <100.00%> (+0.03%) ⬆️

... and 32 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.

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.

2 participants