Skip to content

test_runner: add context subtests expectFailureonlyskiptodo - #62263

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

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

Conversation

@JakobJingleheimer

@JakobJingleheimerJakobJingleheimer 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-botnodejs-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
@codecov

codecovBot 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 linesCoverage Δ
lib/internal/test_runner/test.js97.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.

@atlowChemiatlowChemi 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 threadlib/internal/test_runner/test.js Outdated
@JakobJingleheimer

JakobJingleheimer commented Apr 22, 2026

Copy link
Copy Markdown
MemberAuthor

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 screenshotbefore & 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.

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

Labels

needs-ciPRs that need a full CI run.staletest_runnerIssues 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

@JakobJingleheimer@nodejs-github-bot@H4ad@avivkeller@pmarchini@atlowChemi