Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node:test: Add suite() function to define suites #51430

Closed
justinfagnani opened this issue Jan 10, 2024 · 2 comments · Fixed by #52127
Closed

node:test: Add suite() function to define suites #51430

justinfagnani opened this issue Jan 10, 2024 · 2 comments · Fixed by #52127
Labels
feature request Issues that request new features to be added to Node.js. test_runner Issues and PRs related to the test runner subsystem.

Comments

@justinfagnani
Copy link

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().

@justinfagnani justinfagnani added the feature request Issues that request new features to be added to Node.js. label Jan 10, 2024
@marco-ippolito
Copy link
Member

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
Copy link
Author

Why have the alias of test then? Should it be removed?

@VoltrexKeyva VoltrexKeyva added the test_runner Issues and PRs related to the test runner subsystem. label Jan 13, 2024
cjihrig added a commit to cjihrig/node that referenced this issue Mar 17, 2024
This commit adds a suite() function to the test runner and makes
describe() an alias for it. This matches the it() alias for
test().

Fixes: nodejs#51430
nodejs-github-bot pushed a commit that referenced this issue Mar 19, 2024
This commit adds a suite() function to the test runner and makes
describe() an alias for it. This matches the it() alias for
test().

Fixes: #51430
PR-URL: #52127
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
rdw-msft pushed a commit to rdw-msft/node that referenced this issue Mar 26, 2024
This commit adds a suite() function to the test runner and makes
describe() an alias for it. This matches the it() alias for
test().

Fixes: nodejs#51430
PR-URL: nodejs#52127
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
marco-ippolito pushed a commit that referenced this issue May 2, 2024
This commit adds a suite() function to the test runner and makes
describe() an alias for it. This matches the it() alias for
test().

Fixes: #51430
PR-URL: #52127
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
marco-ippolito pushed a commit that referenced this issue May 3, 2024
This commit adds a suite() function to the test runner and makes
describe() an alias for it. This matches the it() alias for
test().

Fixes: #51430
PR-URL: #52127
Reviewed-By: Chemi Atlow <[email protected]>
Reviewed-By: Moshe Atlow <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Issues that request new features to be added to Node.js. test_runner Issues and PRs related to the test runner subsystem.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants