CheckOps home

Tools directory

D

CheckOps

Deno Test

deno test is Deno's built-in test runner, with Deno.test, test steps, hooks, filtering, sanitizers, mocking and snapshots via the standard library, coverage, documentation tests and affected-test selection.

Visit website

Latest public signals

Not refreshed yet. Refresh reads the public site and, when the entry has a GitHub repository, the latest release.

Visit Website

Introduction

Deno, the JavaScript and TypeScript runtime, includes a test runner invoked with deno test. Tests are registered with Deno.test(), and Deno also supports the node:test API; its documentation explains the differences between them. TypeScript works without configuration, and Deno’s permission model applies to tests, so a test that needs network access must be granted it explicitly.

The documentation covers test steps for structuring tests, timeouts, retrying and repeating tests, parameterised tests, test hooks, filtering, running only tests affected by your git changes or by specific files, ignoring and focusing tests, sanitizers that detect leaked resources and pending async operations, mocking and snapshots through the standard library (@std/testing, @std/expect), coverage with deno coverage, documentation tests that type-check and run code examples, and a guide to migrating from Jest. Deno is MIT-licensed.

Running deno test with permissions such as --allow-net or --allow-read keeps tests honest about what they touch, and the same deno.json tasks and import maps used by the app apply to tests, so there is no separate test configuration to keep in sync.

Features

  1. Built in: deno test with TypeScript and no setup.
  2. Sanitizers: Catch leaked resources, ops and exits.
  3. Affected tests: Run only tests affected by git changes or specific files.
  4. Doc tests and coverage: Test code examples in documentation and report coverage.

Pros

  1. Free: Included with Deno at no cost.
  2. Secure by default: Tests respect Deno’s permission model.

Cons

  1. Requires Deno: Node.js-only projects need a different runner.
  2. Ecosystem differences: Some npm testing libraries need compatibility checks.
// math_test.ts
import { assertEquals } from "jsr:@std/assert";
import { add } from "./math.ts";

Deno.test("add", () => {
  assertEquals(add(2, 3), 5);
});

Deno.test("grouped", async (t) => {
  await t.step("handles zero", () => assertEquals(add(0, 0), 0));
});
deno test
deno test --coverage=cov && deno coverage cov

Resources:

Pricing

Free and open source as part of Deno (MIT licence).

  1. Deno projects wanting a zero-config runner.
  2. Teams that value sanitizers to catch leaks in async code.

Conclusion

deno test is a capable, secure-by-default runner with sanitizers, steps, doc tests and coverage built into the Deno toolchain.

Alternatives

Other tools on CheckOps that cover similar ground. Open a page, or compare one with Deno Test side by side.