deno/tests/specs
2025-12-22 14:28:45 -05:00
..
add fix(add): include type-only imports when building graph (#31552) 2025-12-11 09:29:47 +00:00
audit fix(audit): fix deserde for transitive npm audit actions (#31671) 2025-12-19 08:22:26 +00:00
bench fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
bundle fix(bundle): don't use createRequire when targeting browser in Deno.bundle (#31534) 2025-12-09 00:13:35 +00:00
cache fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
cert
check fix(check): improve node types handling (#31677) 2025-12-20 11:17:45 +01:00
clean fix(install): clean-up lock poll file for a more deterministic node_modules folder output (#29623) 2025-06-06 12:58:10 -04:00
cli fix(ext/telemetry): otel baggage propagation (#31620) 2025-12-16 12:12:29 +00:00
compile fix(compile): make compile work with --unstable-npm-lazy-caching (#31704) 2025-12-22 14:28:45 -05:00
coverage feat(cli): print working dir in grey in stack traces, relative paths in check + compile output (#31194) 2025-11-06 20:38:25 +00:00
doc
eval fix: support cjs, cts, mjs, and mts for the --ext flag (#30398) 2025-08-14 12:02:49 -04:00
flags
fmt feat(BREAKING/fmt): prompt or require deno fmt . when providing no files and no config files discovered (#30623) 2025-09-08 14:28:47 -04:00
future
future_install_node_modules fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
import_map/import_map_config chore(cli): new error message for missing dependency (#30901) 2025-10-02 19:15:55 +01:00
info fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
init feat(init/npm): add --yes flag to bypass prompt (#31499) 2025-12-05 11:07:07 -05:00
install fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
jsr feat(cli): print working dir in grey in stack traces, relative paths in check + compile output (#31194) 2025-11-06 20:38:25 +00:00
jupyter/install_command feat(jupyter): allow to install and maintain multiple kernels (#29249) 2025-05-13 16:56:16 +00:00
lint feat(lint): plugin API has env and read access (#31327) 2025-11-18 12:44:58 +01:00
lockfile fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
node feat: support named pipe listen, connect and open (#31624) 2025-12-19 09:18:48 +01:00
npm fix(x): cache on demand when running, resolve packages with only one binary, don't fail on node-gyp if not present (#31619) 2025-12-15 14:19:17 -08:00
outdated feat(install): add --lockfile-only flag (#31376) 2025-12-04 09:50:11 -05:00
permission feat: --ignore-read (#31363) 2025-12-01 13:58:28 -05:00
publish feat: include @types/node type declarations out of the box (#31502) 2025-12-09 11:58:00 +01:00
remove
repl fix(unstable): fix json repl bugs (#30415) 2025-08-16 17:38:14 +02:00
run tests: update sourcemap tests for npm-only source existence check (#31601) 2025-12-15 19:21:01 -03:00
serve fix(serve): actually wire up resolving main module with import map for deno serve (#29974) 2025-07-02 11:29:23 -07:00
task fix(install): report installed npm packages when not using node_modules, fix double counting (#31536) 2025-12-09 12:20:03 +00:00
test chore: upgrade Rust to 1.92 (#31592) 2025-12-17 17:06:52 +01:00
upgrade chore: fix spec tests not checking test result (#31594) 2025-12-13 23:27:46 +00:00
vendor/removed fix: add another space after warning symbol (#30482) 2025-08-26 08:19:51 -07:00
worker
workspaces feat(cli): print working dir in grey in stack traces, relative paths in check + compile output (#31194) 2025-11-06 20:38:25 +00:00
x fix(x): fix shim script when use custom alias name, re-enable alias tests (#31653) 2025-12-18 10:06:35 +01:00
mod.rs ci: upload test results as artifacts (#31686) 2025-12-22 12:49:29 -05:00
README.md fix(tests): Switch from --nocapture to --no-capture (#30638) 2025-09-08 10:40:56 +02:00
schema.json chore: macos-15-intel runner on ci (#31419) 2025-12-08 23:07:44 +00:00

specs

These are integration tests that execute the deno binary. They supersede the itest macro found in the tests/integration folder and are the preferred way of writing tests that use the deno binary.

Structure

Tests must have the following directory structure:

tests/specs/<category_name>/<test_name>/__test__.json

Test filtering

To run a specific test, run:

cargo test specs::category_name::test_name

Or just the following, though it might run other tests:

cargo test test_name

To run showing the output of every test use -- --no-capture (note: this will cause tests to run sequentially instead of in parallel):

cargo test test_name -- --no-capture

__test__.json file

This file describes the test(s) to execute and the steps to execute. A basic example looks like:

{
  "args": "run main.js",
  "output": "main.out"
}

This will run deno run main.js then assert that the output matches the text in main.out.

Or another example that runs multiple steps:

{
  "tempDir": true,
  "steps": [{
    "args": "cache main.ts",
    "output": "cache.out"
  }, {
    "args": "run main.ts",
    "output": "error.out",
    "exitCode": 1
  }]
}

Or if you want to run several tests at the same time:

{
  "tests": {
    "ignore_dir": {
      "args": "run script.ts",
      "output": "script.out"
    },
    "some_other_test": {
      "args": "run other.ts",
      "output": "other.out"
    }
  }
}

Top level properties

  • repeat (number) - Number of times to repeat a test.
  • tempDir (boolean) - Copy all the non-test files to a temporary directory and execute the command in that temporary directory.
    • By default, tests are executed with a current working directory of the test, but this may not be desirable for tests such as ones that create a node_modules directory.

Step properties

When writing a single step, these may be at the top level rather than nested in a "steps" array or "tests" object.

  • args - A string (that will be split on whitespace into an args array) or an array of arguments.
  • output - Path to use to assert the output or text (must end with an .out extension) or text to pattern match against the output.
  • flaky - Step should be repeated until success a maximum of 3 times.
  • if ("windows", "linux", "mac", "unix") - Whether to run this step.
  • exitCode (number) - Expected exit code.

Auto-complete

To get auto-complete for these files, add the following to a local .vscode/settings.json file:

{
  "json.schemas": [{
    "fileMatch": [
      "__test__.jsonc"
    ],
    "url": "./tests/specs/schema.json"
  }]
}

.out files

.out files are used to assert the output when running a test or test step.

Within the file, you can use the following for matching:

  • [WILDCARD] - match any text at the wildcard
  • [WILDLINE] - match any text on the current line
  • [WILDCHAR] - match the next character
  • [WILDCHARS(5)] - match any of the next 5 characters
  • [UNORDERED_START] followed by many lines then [UNORDERED_END] will match the lines in any order (useful for non-deterministic output)
  • [# example] - line comments start with [# and end with ]