node:test: Add suite() function to define suites #51430
Copy link
Copy link
Closed
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Description
What is the problem this feature will solve?
Right now the node:test docs talk about suites, and include classes like SuiteContext, but the only way to define suites is with the describe() BDD-style function.
While the docs point out that "it is a shorthand for test()", there isn't yet a suite() function that describe() is a shorthand for.
Grouping tests with test() isn't the same, since that requires awaiting the subtests, which suites don't require.
What is the feature you are proposing to solve the problem?
Add a test() export that describe() is a shorthand for, like how it() is for test().
What alternatives have you considered?
import {test, describe as suite} from 'node:test';However this doesn't address the issue that there's a missing correspondence between the typical describe/it and suite/test APIs, or that currently suites are a first-class concept, but only available via describe().
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
feature requestIssues requesting new Node.js features.Issues requesting new Node.js features.test_runnerIssues and PRs related to the test runner subsystem.Issues and PRs related to the test runner subsystem.
Activity
marco-ippolito commentedon Jan 10, 2024
What's wrong with using describe/it syntax if you need the feature they are meant for?
I'm not sure about adding an alias of describe to match test
justinfagnani commentedon Jan 10, 2024
Why have the alias of
testthen? Shoulditbe removed?test_runner: add suite()
test_runner: add suite()
test_runner: add suite()
test_runner: add suite()