deno/tests/specs
2025-11-05 14:59:59 +01:00
..
add feat(install): refresh install report (#30615) 2025-09-08 09:44:22 +00:00
audit fix(audit): handle 'review' actions (#31100) 2025-10-27 12:44:02 +01:00
bench fix(cli/args): empty permissions in config should not require -P (#31063) 2025-10-22 21:05:22 -04:00
bundle chore(cli): new error message for missing dependency (#30901) 2025-10-02 19:15:55 +01:00
cache fix(cache): don't try to set up node_modules with node_modules_dir manual in deno cache (#30957) 2025-10-09 10:46:54 +02:00
cert refactor: extract out FileFetcher to deno_cache_dir (#27263) 2024-12-16 23:39:40 +00:00
check fix(check): support text and bytes imports with --unstable-tsgo (#31084) 2025-10-24 23:41:20 +00: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 feat(unstable): dynamic command-line completions for deno task (#30670) 2025-10-21 23:05:42 +00:00
compile fix(compile): support --preload flag in deno compile (#31152) 2025-11-03 11:41:27 +01:00
coverage fix(coverage): don't process coverage for blob: urls (#31035) 2025-10-21 08:59:21 +02:00
doc feat(doc): add darkmode for HTML output (#28989) 2025-04-21 13:02:50 -07:00
eval fix: support cjs, cts, mjs, and mts for the --ext flag (#30398) 2025-08-14 12:02:49 -04:00
flags feat: add lowercase -v version flag (#23750) 2024-05-23 00:20:20 +00:00
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 chore: upgrade to rust 1.82 and LLVM 19 (#26615) 2024-11-01 16:13:02 +05:30
future_install_node_modules feat(install): refresh install report (#30615) 2025-09-08 09:44:22 +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 feat(install): refresh install report (#30615) 2025-09-08 09:44:22 +00:00
init feat(init): add --npm flag to initialize npm projects (#26896) 2024-11-21 00:03:11 +00:00
install feat(unstable): ability to exclude packages from minimum dependency age constraint (#31031) 2025-10-23 12:13:37 -04:00
jsr fix: do not purge lockfile when linking and the linked package's reqs have not changed (#30877) 2025-09-30 14:31:48 -04:00
jupyter/install_command feat(jupyter): allow to install and maintain multiple kernels (#29249) 2025-05-13 16:56:16 +00:00
lint fix(cli): jsx pragma-related swc panics (#30935) 2025-10-06 23:25:13 +00:00
lockfile fix(check): error when type checking after deduping packages (#31049) 2025-10-21 23:11:01 -04:00
node fix(ext/node): inconsistent error message thrown by AssertionError (#31089) 2025-10-28 09:51:09 +01:00
npm feat(config): allow storing npm constraints to allow running lifecycle scripts for (#31075) 2025-11-05 14:59:59 +01:00
outdated fix(update): preserve tilde in version range (#30946) 2025-10-08 17:50:30 +00:00
permission feat: Add --deny-import flag (#29702) 2025-06-28 12:59:18 +00:00
publish fix: upgrade to swc_ecma_parser 23 (#30564) 2025-08-29 15:36:36 -04:00
remove feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
repl fix(unstable): fix json repl bugs (#30415) 2025-08-16 17:38:14 +02:00
run test: add regression test for --preload with same module as main (#31190) 2025-11-05 08:51:47 +01: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 feat(install): refresh install report (#30615) 2025-09-08 09:44:22 +00:00
test fix(cli/args): empty permissions in config should not require -P (#31063) 2025-10-22 21:05:22 -04:00
upgrade chore: fix two locally failing on windows tests (#27845) 2025-01-28 10:46:43 -05:00
vendor/removed fix: add another space after warning symbol (#30482) 2025-08-26 08:19:51 -07:00
worker feat: add --allow-import flag (#25469) 2024-09-26 01:50:54 +00:00
workspaces fix(unstable): rename "patch" property to "links" (#29677) 2025-06-10 21:51:23 +00:00
mod.rs feat(unstable): typescript-go integration for deno check (#30920) 2025-10-20 09:59:54 -07:00
README.md fix(tests): Switch from --nocapture to --no-capture (#30638) 2025-09-08 10:40:56 +02:00
schema.json feat(internal): support variants of spec tests (#30947) 2025-10-08 17:46:33 +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 ]