new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Deno · Reference · all subjects

cli commands/test

21 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

deno test - basic syntax

The basic command to run all tests in the current directory and subdirectories is 'deno test'. To run tests in specific files, use 'deno test' followed by file paths (e.g., 'deno test src/fetch_test.ts src/signal_test.ts'). To run tests matching a glob pattern, use 'deno test' with the glob pattern (e.g., 'deno test src/*.test.ts').

deno test --no-check flag

The --no-check flag skips type-checking when running tests. Usage: deno test --no-check

deno test --filter flag

The --filter flag runs only tests whose name matches a string or pattern. Wrap the filter value in forward slashes (/) to treat it as a regular expression. Example: 'deno test --filter "database"' runs tests whose name contains 'database'; 'deno test --filter "/^connect.*/"' runs tests matching a regular expression. Filtering does not affect test steps: when a test's name matches the filter, all of its steps run.

deno test --changed flag

The --changed flag runs test modules affected by files changed in git. With no value it uses the working tree (staged, unstaged, and untracked files); pass a ref to also include commits since the merge-base with that ref. Example: 'deno test --changed' runs tests affected by uncommitted changes; 'deno test --changed=origin/main' runs tests affected since branching off main.

deno test --related flag

The --related flag runs test modules that depend on specific source files, without consulting git. Example: 'deno test --related=src/util.ts' runs tests that import src/util.ts.

deno test permission flags

Tests run with the same permission model as 'deno run'. Grant permissions for test suites using flags like --allow-read and --allow-net. Example: 'deno test --allow-read --allow-net'

deno test --watch flag

The --watch flag re-runs tests automatically when files change. Usage: deno test --watch

deno test --parallel flag

The --parallel flag runs test files across multiple worker threads. By default, --parallel uses the number of available CPUs. Use the DENO_JOBS=<N> environment variable to control the number of threads. Example: 'deno test --parallel' or 'DENO_JOBS=4 deno test --parallel'

deno test --coverage flag

The --coverage flag collects coverage data and generates a report, writing raw coverage data to a 'coverage/' directory. To generate a summary from existing coverage data, use 'deno coverage coverage/'. To output an lcov report for use with external tools, use 'deno coverage --lcov coverage/ > coverage.lcov'. To fail the run when coverage drops below a target, set a threshold with 'deno coverage --threshold=90'.

deno test --reporter flag

The --reporter flag chooses an output format. Four reporters are built in: 'pretty' (default, detailed and human-readable output), 'dot' (one character per test for a concise overview), 'junit' (JUnit XML format for CI systems), and 'tap' (Test Anything Protocol output). Usage examples: 'deno test --reporter=dot' or 'deno test --reporter=tap'

deno test --junit-path flag

The --junit-path flag writes a JUnit XML report to a specified file while keeping the human-readable 'pretty' output in the terminal. Example: 'deno test --junit-path=report.xml'

deno test --shuffle flag

The --shuffle flag randomizes the order tests run in to catch hidden dependencies between tests. Usage: deno test --shuffle

deno test --shard flag

The --shard flag splits a test suite across several machines using the syntax --shard=<index>/<count>, where <index> is 1-based. The discovered test files are sorted for a stable order and divided into <count> balanced groups; the run executes only the files in group <index>. Examples: 'deno test --shard=1/3' on machine 1 of 3, or 'deno test --shard=2/3' on machine 2 of 3. Sharding is applied before --shuffle, so a given shard runs the same files on every machine regardless of the shuffle seed.

deno test --retry flag

The --retry flag sets a run-wide default for retries, re-running each failing test up to the specified number of times before reporting failure. Example: 'deno test --retry=2' re-runs each failing test up to twice. A test that sets its own retry option overrides the flag.

deno test --repeats flag

The --repeats flag sets a run-wide default for repetitions, running every test the specified number of times and failing if any run fails. Example: 'deno test --repeats=3' runs every test three times. A test that sets its own repeats option overrides the flag.

deno test --trace-leaks flag

The --trace-leaks flag traces the source of leaked async operations, timers, or resources. Usage: deno test --trace-leaks

deno test --doc flag

The --doc flag evaluates code blocks in JSDoc and Markdown files as tests. Usage: deno test --doc

deno test --update-snapshots flag

The --update-snapshots flag (short form: -u) updates snapshot tests. It works with the built-in 't.assertSnapshot' function to capture a value and compare it against a stored reference on every run.

deno test with coverage collection

Use `deno test --coverage=cov/` to run all test files in the repository and collect code coverage. It is recommended to run with the minimal permissions your program needs rather than `--allow-all`.

--allow-none flag renamed to --permit-no-files

The --allow-none CLI flag has been renamed to --permit-no-files in Deno 2. Use deno test --permit-no-files instead of deno test --allow-none.

--trace-ops flag renamed to --trace-leaks

The --trace-ops CLI flag has been renamed to --trace-leaks in Deno 2. Use deno test --trace-leaks instead of deno test --trace-ops.

Give your agent this brain