deno/tests/specs
2025-05-28 11:59:26 +02:00
..
add feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
bench chore: skip explicit_start_and_end_low_precision test on ci (#28789) 2025-04-07 17:55:18 -07:00
bundle/removed fix: add info suggestion for unsafely-ignore-certificate-errors and add --help=full (#28203) 2025-02-24 08:20:59 -08:00
cache feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
cert refactor: extract out FileFetcher to deno_cache_dir (#27263) 2024-12-16 23:39:40 +00:00
check fix(check): ignore errors on ambient modules (#29135) 2025-05-16 15:06:34 +09:00
clean feat(clean): deno clean --except <paths>, remove all cache data except what's needed to run paths (#28424) 2025-04-29 22:42:17 +00:00
cli fix: allow specifying otel config in --env-file (#29240) 2025-05-11 21:09:52 -04:00
compile fix(compile): pass default v8 args during compile (#29084) 2025-04-29 10:13:54 -04:00
coverage fix(coverage): don't panic if all covered files are ignored via directive (#29250) 2025-05-12 02:47:32 +02:00
doc feat(doc): add darkmode for HTML output (#28989) 2025-04-21 13:02:50 -07:00
eval feat(node): stabilize detecting if CJS via "type": "commonjs" in a package.json (#26439) 2024-11-13 15:10:09 +00:00
flags feat: add lowercase -v version flag (#23750) 2024-05-23 00:20:20 +00:00
fmt fix(fmt): allow expressions used as key-value pair in css template literals (#29369) 2025-05-26 10:50:36 +09: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(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
import_map/import_map_config refactor: move importMap with imports/scopes diagnostic to deno_config (#24553) 2024-07-12 12:48:53 -04:00
info feat(info): include deno version (#29080) 2025-04-28 18:41:30 +01:00
init feat(init): add --npm flag to initialize npm projects (#26896) 2024-11-21 00:03:11 +00:00
install fix(install): error gracefully if user passes --no-config to deno install <package> (#28965) 2025-04-18 22:13:20 +00:00
jsr fix(check): compiler options from workspace members (#27785) 2025-01-28 10:49:58 -05:00
jupyter/install_command feat(jupyter): allow to install and maintain multiple kernels (#29249) 2025-05-13 16:56:16 +00:00
lint feat(unstable): support comments in lint plugin (#29189) 2025-05-08 21:59:36 +02:00
lockfile fix(npm): respect etag for npm packument caching (#29130) 2025-05-02 09:49:05 -04:00
node fix(ext/node): createInterface doesn't require env permission (#29472) 2025-05-28 11:59:26 +02:00
npm fix(npm): respect etag for npm packument caching (#29130) 2025-05-02 09:49:05 -04:00
outdated fix: break unstable lockfile v5 to remove "has" from property names (#29095) 2025-04-29 14:17:54 -04:00
permission fix(permissions): implicit --allow-import when using --cached-only (#27530) 2025-01-02 16:55:03 -05:00
publish feat: code sign deno.exe (#28963) 2025-04-25 08:27:12 +02:00
remove feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
repl/console_log chore: Happy New Year 2025 (#27509) 2024-12-31 19:12:39 +00:00
run fix: load changed non-remote dynamic imports at runtime (#29413) 2025-05-26 21:38:51 +00:00
serve fix: add hint to run with --no-check when type checking fails (#28091) 2025-02-13 10:54:52 +00:00
task fix(task): support --frozen flag (#28094) 2025-02-13 13:22:15 +01:00
test fix(node/test): basic support for t.skip and t.todo (#29222) 2025-05-09 01:40:16 +02:00
upgrade chore: fix two locally failing on windows tests (#27845) 2025-01-28 10:46:43 -05:00
vendor/removed fix: add info suggestion for unsafely-ignore-certificate-errors and add --help=full (#28203) 2025-02-24 08:20:59 -08:00
worker feat: add --allow-import flag (#25469) 2024-09-26 01:50:54 +00:00
workspaces feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
mod.rs feat(fmt): support formatting of embedded css, html, and sql (#29014) 2025-04-29 22:17:55 +09:00
README.md docs: fix a typo in specs README.md (#28524) 2025-03-17 17:46:22 +09:00
schema.json fix(compile): analyze modules in directory specified in --include (#27296) 2024-12-12 18:07:35 +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 -- --nocapture (note: this will cause tests to run sequentially instead of in parallel):

cargo test test_name -- --nocapture

__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 ]