test runner (--test, node:test) subtest test context lack `.skip`, `.only` and `.todo` functions
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 38/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, node.js
- Domain
- testing
Research direction
Start at the node:test subtest API entry point and reproduce the supplied nested test with node --test, or without the flag. Compare the documented behavior of t.test.only, t.test.skip, and t.test.todo with the observed TypeErrors; done means the nested API behavior and documentation agree on the intended behavior.
Written by the indexing model from the issue text.
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
- Dominant language
- JavaScript
- Stars
- 122k
- Forks
- 37.4k
- Avg merge
- 4d 3h
- Merged PRs (30d)
- 272
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nodejs/node
-
doc
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
build
Difficulty 1/5 Under an hour Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
-
feature request
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Similar issues
-
code-quality refactoring
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
langchain-ai/deepagents#6450 ·
-
optimization optimization:agents-md-curator
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
githubnext/gh-aw-cao#13143 ·
-
status: needs triage
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100