一键导入
node-compat
// Run a Node.js compatibility test, diagnose failures, and either fix the implementation, skip, or ignore the test. Use when asked to work on node compat tests.
// Run a Node.js compatibility test, diagnose failures, and either fix the implementation, skip, or ignore the test. Use when asked to work on node compat tests.
| name | node-compat |
| description | Run a Node.js compatibility test, diagnose failures, and either fix the implementation, skip, or ignore the test. Use when asked to work on node compat tests. |
| argument-hint | <test-name> |
| allowed-tools | Bash Read Write Edit Glob Grep Agent |
Work on Node.js compatibility test $ARGUMENTS.
./x build
./x test-compat $ARGUMENTS
If the test passes, report success and ensure test is specified in
tests/node_compat/config.jsonc.
Read the test file to understand what it tests:
# Tests live under tests/node_compat/test/
Use Grep and Read to find the test source, then analyze:
ext/node/ (polyfills,
ops, internal bindings), runtime/, or cli/.Read the corresponding Node.js docs and/or source code to understand the expected behavior.
Determine which category this failure falls into:
The Deno implementation is wrong or incomplete, but can be corrected. This includes:
Action: Fix the implementation (Step 4).
The test relies on Node.js internals or architecture that Deno fundamentally cannot or will not support:
internalBinding() calls to Node's C++ layer--inspect, --prof, etc.)Action: Ignore the test with a reason (Step 5).
The test exercises an edge case or behavior that is technically possible but provides negligible value:
Action: Ignore or skip the test with a reason (Step 5).
If the failure is fixable:
ext/node/ (or elsewhere)../x build - this is paramount, changes won't
take effect until you do../x test-compat $ARGUMENTS
tests/node_compat/config.jsonc with an empty config:"category/test-name.js": {}
The entries in config.jsonc are sorted alphabetically within their category.
Place the new entry in the correct position.
If the test cannot or should not be fixed, update
tests/node_compat/config.jsonc.
"category/test-name.js": {
"ignore": true,
"reason": "Brief, specific explanation of why this can't work in Deno"
}
"reason" must be specified otherwise the lint step will fail!
If the test only fails on certain platforms:
"category/test-name.js": {
"windows": false
}
If you want the test to run but expect a specific failure:
"category/test-name.js": {
"exitCode": 1,
"output": "[WILDCARD]specific error message[WILDCARD]",
"reason": "Brief explanation of why this fails"
}
This is a good middle ground for tests that are generally compatible but have a specific known issue. If a fix is ever done this assertion will notify the implementer to update the config.
Reasons should be specific and actionable. Good examples:
deno --interactive flag (not yet implemented)"Bad examples:
Re-run the test one final time to confirm the outcome matches expectations:
./x test-compat $ARGUMENTS
The full schema for config.jsonc entries is in
tests/node_compat/schema.json.
When opening a PR for node-compat work, use the appropriate prefix:
test: — when the PR only updates tests/node_compat/config.jsonc to skip,
ignore, or otherwise reclassify tests without changing implementation code.fix(ext/node): — when the PR actually fixes the implementation so a
previously failing test now passes (typically changes under ext/node/ plus
enabling the test in config.jsonc).Format all code in the repository. Run before opening a PR or committing changes.
Triage a Deno GitHub issue — reproduce bugs, classify, label, and comment with findings. Use when asked to triage an issue or when an issue number/URL is provided for triage.
Lint all code (Rust + JS/TS). Use before opening a PR when Rust code was changed.
Lint JS/TS code only. Use before opening a PR when only JavaScript or TypeScript files were changed (no Rust).
Review a Deno runtime pull request for correctness, tests, security, and conventions. Use when asked to review a PR or when a PR number/URL is provided for review.