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

Add Mocha/Jest like APIs to node:test #43415

Closed
MoLow opened this issue Jun 13, 2022 · 5 comments
Closed

Add Mocha/Jest like APIs to node:test #43415

MoLow opened this issue Jun 13, 2022 · 5 comments
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

@MoLow
Copy link
Member

MoLow commented Jun 13, 2022

What is the problem this feature will solve?

help wider adoption of node:test as a native test runner

What is the feature you are proposing to solve the problem?

following the discussion here #40954
it seems like there was no strong opionons against supporting mocha/jest test styles,
So I think adding the describe and it APIs for starters can be fairly easy

What alternatives have you considered?

No response

@MoLow MoLow added the feature request Issues that request new features to be added to Node.js. label Jun 13, 2022
@MoLow
Copy link
Member Author

MoLow commented Jun 13, 2022

If this sounds reasonable I would submit a PR

@benjamingr
Copy link
Member

cc @nodejs/test_runner @cjihrig

@ljharb
Copy link
Member

ljharb commented Jun 13, 2022

These styles are typically magic globals, which is definitely not a great thing.

If someone wants to import/require describe and it etc, then that'd be one thing.

However, one probably wouldn't want multiple styles in the same codebase. Perhaps it should be configurable, and only one style at a time supported?

@benjamingr
Copy link
Member

If someone wants to import/require describe and it etc, then that'd be one thing.

I assumed that's what we're talking about (exposing them and not defining them as globals, right?)

However, one probably wouldn't want multiple styles in the same codebase. Perhaps it should be configurable, and only one style at a time supported?

Actually I've seen it before (tools like jest typically support both styles and people use them for different things) - I don't do it myself but it definitely exists "in the wild".

@MoLow
Copy link
Member Author

MoLow commented Jun 13, 2022

@ljharb @benjamingr I was totally thinking something like import { describe, it } from 'node:test', not using globals

@F3n67u F3n67u added the test_runner Issues and PRs related to the test runner subsystem. label Jun 14, 2022
benjamingr pushed a commit that referenced this issue Jun 29, 2022
PR-URL: #43420
Refs: #43415
Reviewed-By: Benjamin Gruenbaum <[email protected]>
@MoLow MoLow closed this as completed Jun 29, 2022
mabaasit pushed a commit to mabaasit/node that referenced this issue Jul 6, 2022
aduh95 pushed a commit to aduh95/node-core-test that referenced this issue Jul 8, 2022
aduh95 pushed a commit to aduh95/node-core-test that referenced this issue Jul 9, 2022
aduh95 pushed a commit to aduh95/node-core-test that referenced this issue Jul 9, 2022
targos pushed a commit that referenced this issue Jul 12, 2022
PR-URL: #43420
Refs: #43415
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this issue Jul 31, 2022
PR-URL: #43420
Refs: #43415
Reviewed-By: Benjamin Gruenbaum <[email protected]>
guangwong pushed a commit to noslate-project/node that referenced this issue Oct 10, 2022
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

No branches or pull requests

4 participants