f5e46c9bf2
This looks like a massive PR, but it's only a move from cli/tests -> tests, and updates of relative paths for files. This is the first step towards aggregate all of the integration test files under tests/, which will lead to a set of integration tests that can run without the CLI binary being built. While we could leave these tests under `cli`, it would require us to keep a more complex directory structure for the various test runners. In addition, we have a lot of complexity to ignore various test files in the `cli` project itself (cargo publish exclusion rules, autotests = false, etc). And finally, the `tests/` folder will eventually house the `test_ffi`, `test_napi` and other testing code, reducing the size of the root repo directory. For easier review, the extremely large and noisy "move" is in the first commit (with no changes -- just a move), while the remainder of the changes to actual files is in the second commit. |
||
---|---|---|
.. | ||
node@b114fad0ec | ||
.gitignore | ||
deno.json | ||
README.md | ||
setup.ts | ||
TODO.md |
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_compat/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
- Update
tests
property of//cli/tests/node_compat/config.jsonc
. For example, if you want to addtest/parallel/test-foo.js
from Node.js test cases, then addtest-foo.js
entry intests.parallel
array property inconfig.jsonc
- Run
deno task setup
intools/node_compat
dir.
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
property 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
. If you want to run specific tests you can use the
command deno task test
(in tools/node_compat
dir). For example, if you want
to run all test files which contains buffer
in filename you can use the
command:
/path/to/deno/tools/node_compat
$ deno task test buffer