Skip to main content
GoodFirstPicks
DashboardIssuesReposLeaderboard

GoodFirstPicks by Leaveitblank © 2026

CreatorRequest a RepoPrivacy PolicyTerms of Service
test runner (--test, node:test) subtest test context lack `.skip`, `.only` and `.todo` functions | GoodFirstPicks

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

nodejs/node 6 comments 1mo ago
View on GitHub
lowopenScope: clearSkill match: yesTest focusedNode.jsJavaScript

Why this is a good first issue

The issue involves missing test runner functions for subtests, which contradicts the documentation.

AI Summary

The issue reports that `.skip`, `.only`, and `.todo` functions are missing for subtests in the Node.js test runner, despite documentation stating they should work identically to top-level tests. The fix involves implementing these functions for subtests. There is no indication of blockers, but maintainers have differing opinions on whether this is a bug or an unimplemented feature.

Issue Description

Version

20.7.0

Platform

Linux void-desktop 6.5.9_1 #1 SMP PREEMPT_DYNAMIC Thu Oct 26 12:11:50 UTC 2023 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

const test = require('node:test');

test('Parent', t => {
	t.test.only('Child only', () => {});
	t.test.skip('Child skip', () => {});
	t.test.todo('Child todo', () => {});
});

Run with node --test <file> (same result without the --test flag)

How often does it reproduce? Is there a required condition?

Consistently

What is the expected behavior? Why is that the expected behavior?

All functions work as described here: https://nodejs.org/docs/latest-v20.x/api/test.html#subtests

This method behaves identically to the top level test() function. The following example demonstrates the creation of a top level test with two subtests.

What do you see instead?

TypeError [Error]: t.test.todo is not a function
TypeError [Error]: t.test.skip is not a function
TypeError [Error]: t.test.only is not a function

Additional information

These functions work for top-level test, they don't work for nested tests. Maybe it doesn't make sense to expose those functions for subtests (use just describe - maybe it's enough), but in that case the documentation is misleading

GitHub Labels

confirmed-bugtest_runner

Want to work on this?

Claim this issue to let others know you're working on it. You'll earn 10 points when you complete it!

Risk Flags

  • potential documentation inconsistency
Loading labels...

Details

Points10 pts
Difficultylow
Scopeclear
Skill Matchyes
Test Focusedyes