1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-27 09:39:08 -05:00
denoland-deno/tools/node_compat
2023-05-26 05:00:29 +02:00
..
node@d0d9c1ba9d chore: check node_compat config diff in CI (#19119) 2023-05-15 21:22:53 +09:00
.gitignore chore(tools): restore node compat test setup script (#18290) 2023-03-21 22:38:07 +09:00
README.md chore(node_compat): fix broken link and typo (#19265) 2023-05-26 05:00:29 +02:00
setup.ts chore: check node_compat config diff in CI (#19119) 2023-05-15 21:22:53 +09:00
TODO.md fix(ext/node): fix whatwg url formatting (#19146) 2023-05-17 14:51:51 +09:00

Tools for Node.js compatibility work

We run native Node.js test cases against our Node.js compatibility feature.

This directory includes the tools for downloading, setting up, and updating the Node.js compat testing in Deno repository.

  • //tools/node_compat/setup.ts
    • This script sets up the Node.js compat tests.
  • //tools/node_comapt/versions/
    • Node.js source tarballs and extracted test cases are stored here.
  • //cli/tests/node_compat/config.jsonc
    • This json file stores the settings about which Node.js compat test to run with Deno.
  • //cli/tests/node_compat/test
    • The actual test cases are stored here.

Steps to add new test cases from Node.js test cases

  1. Update tests property of //cli/tests/node_compat/config.jsonc. For example, if you want to add test/paralles/test-foo.js from Node.js test cases, then add test-foo.js entry in tests.parallel array property in config.jsonc
  2. Run ./tools/node_compat/setup.ts

The above command copies the updated items from Node.js tarball to the Deno source tree.

Ideally Deno should pass the Node.js compat tests without modification, but if you need to modify it, then add that item in ignore perperty of config.jsonc. Then setup.ts doesn't overwrite the modified Node.js test cases anymore.

If the test needs to be ignored in particular platform, then add them in ${platform}Ignore property of config.jsonc

Run Node.js test cases

Node.js compat tests are run as part of cargo test command. If you want to run only the Node.js compat test cases you can use the command cargo test node_compat.