Skip to content

test_runner: add context subtests expectFailure only skip todo - #62263

Open
JakobJingleheimer wants to merge 5 commits into
nodejs:mainfrom
JakobJingleheimer:test-runner/fix/subtest-context
Open

test_runner: add context subtests expectFailure only skip todo#62263
JakobJingleheimer wants to merge 5 commits into
nodejs:mainfrom
JakobJingleheimer:test-runner/fix/subtest-context

Conversation

@JakobJingleheimer

@JakobJingleheimer JakobJingleheimer commented Mar 15, 2026

Copy link
Copy Markdown
Member

Closes #61251
Closes #62156
Fixes #50665

Co-Authored-By: Heath Dutton🕴️ <heathdutton@linux.com>
Co-Authored-By: Felipe <60716370+felipeness@users.noreply.github.com>
@nodejs-github-bot

Copy link
Copy Markdown
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 Mar 15, 2026
@JakobJingleheimer JakobJingleheimer moved this to In Progress in Test Runner Board Mar 15, 2026
@codecov

codecov Bot commented Mar 15, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.79%. Comparing base (1989f4d) to head (bc3b228).
⚠️ Report is 1296 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #62263      +/-   ##
==========================================
+ Coverage   89.65%   89.79%   +0.13%     
==========================================
  Files         676      697      +21     
  Lines      206555   215809    +9254     
  Branches    39547    41306    +1759     
==========================================
+ Hits       185195   193787    +8592     
- Misses      13495    14112     +617     
- Partials     7865     7910      +45     
Files with missing lines Coverage Δ
lib/internal/test_runner/test.js 97.00% <100.00%> (+0.19%) ⬆️

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

@atlowChemi atlowChemi added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Mar 15, 2026
Comment thread lib/internal/test_runner/test.js Outdated
@JakobJingleheimer

JakobJingleheimer commented Apr 22, 2026

Copy link
Copy Markdown
Member Author

Okee I finally figure out what is wrong:

  at Test.start (node:internal/test_runner/test:…)
- at TestContext.test (node:internal/test_runner/test:377:20)
+ at #runTest (node:internal/test_runner/test:378:20)
+ at test.ObjectAssign.__proto__ [as test] (node:internal/test_runner/test:383:59)
  at TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/hooks.js:197:11)
- at Test.runInAsyncScope (node:async_hooks:226:14)
full diff screenshot before & after diff

The problem is the new implementation replaces 1 entry (at TestContext.test) in the middle of the stack with 2 entries (at #runTest and at test.ObjectAssign.__proto__), and getCallerLocation() returns 10 entries, causing the bottom Test.runInAsyncScope to get lobbed off.

There are 2 things to consider here:

  • at #runTest and at test.ObjectAssign.__proto__ is not as pretty as at TestContext.test
    • moving the ObjectAssign to the constructor (ObjectAssign(this.test, {…}) does make the stack prettier:
      at Test.start (node:internal/test_runner/test:1136:17)
      at #runTest (node:internal/test_runner/test:406:20)
      at TestContext.test (node:internal/test_runner/test:412:25)
      at TestContext.<anonymous> (<project-root>/test/fixtures/test-runner/output/hooks.js:197:11)
      
  • is that bottom Test.runInAsyncScope important?

@github-actions

Copy link
Copy Markdown
Contributor

This pull request has been marked as stale due to 90 days of inactivity.
It will be automatically closed in 30 days if no further activity occurs. If this is still relevant, please leave a comment or update it to keep it open.

@github-actions github-actions Bot added the stale label Jul 28, 2026
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. stale test_runner Issues and PRs related to the test runner subsystem.

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

test runner (--test, node:test) subtest test context lack .skip, .only and .todo functions

6 participants