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

Isomorphic Test Runner #50366

Closed
dalssoft opened this issue Oct 24, 2023 · 1 comment
Closed

Isomorphic Test Runner #50366

dalssoft opened this issue Oct 24, 2023 · 1 comment
Labels
feature request Issues that request new features to be added to Node.js.

Comments

@dalssoft
Copy link

What is the problem this feature will solve?

Currently I'm developing a library that runs both on node.js and on the browser and I would like to use node.js native test runner. However, I won't be able to use it because it only runs on node.js.

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

It seems that it is possible to run the test runner in the browser, as a quick look at the code, it seems to me that it is just javascript code (no native code) and no specific node dependencies.

I can think of a few alternatives:

  • Create a new package that runs on the browser and node.js.
    pros: one package for both environments. also make node.js more useful for isomorphic libraries.
    cons: it will be a new package that the core depends on. Also, new requirement to make it work on the browser.

  • Create a new package that runs on the browser and mimic the node.js test runner.
    pros: no dependency on the core.
    cons: two separate codes to maintain.

What alternatives have you considered?

Mocha: runs on the browser and node.js, but it is not TAP compatible. Also, depends on changing global variables.
Jest: runs on the browser and node.js, but it is not TAP compatible. Also, depends on changing global variables.
Tape: runs on the browser and node.js, but it has not the same authority as node.js test runner.
Ava: runs on node.js, but not on the browser (experimental).

@dalssoft dalssoft added the feature request Issues that request new features to be added to Node.js. label Oct 24, 2023
@richardlau
Copy link
Member

node:test was ported to userland in https://github.com/nodejs/node-core-test
On npm: https://www.npmjs.com/package/test
I believe it's manually synced to the code in nodejs/node: https://github.com/nodejs/node-core-test/wiki/How-this-repo-is-mantained

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.
Projects
None yet
Development

No branches or pull requests

2 participants