deno/tests/specs
Nayeem Rahman 7a9ab843bd
feat(check): tsconfig "references", "extends", "files", "include" and "exclude" (#29843)
- Each workspace directory is probed for a `tsconfig.json`.
- These and any that are included by their `references` are put into a
list ordered by priority.
  - A tsconfig has lower priority than its `references`.
- An earlier listed entry in `references` has higher priority than a
later one.
- A probed tsconfig in an inner directory has higher priority than an
outer one. Their `references` would be interspersed between them.
- Each tsconfig has a filter based on its `files`, `include` and
`exclude` fields. If it doesn't have `files` or `include`, it will match
any path in its containing directory not exempted by `exclude`.
- For type-checking, each root path will be allocated compiler options
based on the first tsconfig it whose filter it matches from this list.
- Only if it doesn't match any tsconfig, it will fall back to using the
nearest `deno.json`. If it's a workspace member and the root `deno.json`
has `compilerOptions`, these will be merged using the same logic from
`extends`.

Inheritance between configs strictly occurs via `extends` in a
`tsconfig.json`, and between workspace member and root `deno.json`s'
`compilerOptions`. There is no implicit inheritance between
`tsconfig.json` and `deno.json`.

The default compiler options currently applied against tsconfigs are
Deno's normal defaults, with the exception of `lib`. The default value
for `lib` is `["deno.window", "deno.unstable", "dom"]` for files in the
scope of a tsconfig with `lib` unspecified. This behaviour is depended
on by, for example, the template project created by `create-vite ->
svelte`. I expect we'll add more such exceptions over time with other
fields.
2025-06-26 21:17:07 +00:00
..
add feat(lockfile): default to lockfile v5 (#28950) 2025-04-17 13:27:37 -07:00
bench fix(bench): Make output table markdown compatible (#29532) 2025-06-24 11:27:42 +02:00
bundle fix(bundle): only replace require shim in js files, spruce up output (#29892) 2025-06-26 18:35:19 +00: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 feat(check): tsconfig "references", "extends", "files", "include" and "exclude" (#29843) 2025-06-26 21:17:07 +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(otel): stabilize OpenTelemetry support (#29822) 2025-06-24 16:49:04 +02:00
compile fix(unstable): rename "patch" property to "links" (#29677) 2025-06-10 21:51:23 +00:00
coverage test: fix specs::coverage::data_url test (#29865) 2025-06-24 16:22:28 +05:30
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 feat(fmt): add support for .xml, .svg and .mustache files (#29851) 2025-06-24 17:16:33 +02: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(unstable): bytes and text imports (#29855) 2025-06-26 11:21:16 -04:00
init feat(init): add --npm flag to initialize npm projects (#26896) 2024-11-21 00:03:11 +00:00
install fix(install,outdated): try to avoid building graph with incorrect exports (#29713) 2025-06-12 09:23:05 -07:00
jsr fix(jsr): allow using import.meta.resolve to resolve non-jsr remote urls (#29831) 2025-06-20 22:05:38 +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: make setImmediate and clearImmediate as globals (#29877) 2025-06-25 15:21:10 +02:00
lockfile fix(npm): respect etag for npm packument caching (#29130) 2025-05-02 09:49:05 -04:00
node feat: add DENO_COMPAT env var (#29889) 2025-06-26 12:06:24 +02:00
npm feat(check): tsconfig "references", "extends", "files", "include" and "exclude" (#29843) 2025-06-26 21:17:07 +00:00
outdated feat: add 'deno update' subcommand (#29187) 2025-06-26 19:13:29 +02: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 feat(check): tsconfig "references", "extends", "files", "include" and "exclude" (#29843) 2025-06-26 21:17:07 +00:00
serve feat(ext/http): support onListen() callback in deno serve (#29449) 2025-06-25 15:20:27 +02:00
task fix(process,node): roll our own process spawning on windows (#29609) 2025-06-12 02:56:13 +00: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 fix(unstable): rename "patch" property to "links" (#29677) 2025-06-10 21:51:23 +00:00
mod.rs refactor(install): support tarball extract in Wasm (#29587) 2025-06-04 13:51:26 +00:00
README.md docs: fix a typo in specs README.md (#28524) 2025-03-17 17:46:22 +09:00
schema.json refactor(install): support tarball extract in Wasm (#29587) 2025-06-04 13:51:26 +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 ]