Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/lib.deno.d.ts>Deno.test

A JavaScript extension package for building strong and modern applications.
Latest
variable Deno.test
import { Deno } from "https://deno.land/x/ayonli_jsext@v0.9.72/lib.deno.d.ts";
const { test } = Deno;

Register a test which will be run when deno test is used on the command line and the containing module looks like a test module.

fn can be async if required.

import { assertEquals } from "https://deno.land/std/assert/mod.ts";

Deno.test({
  name: "example test",
  fn() {
    assertEquals("world", "world");
  },
});

Deno.test({
  name: "example ignored test",
  ignore: Deno.build.os === "windows",
  fn() {
    // This test is ignored only on Windows machines
  },
});

Deno.test({
  name: "example async test",
  async fn() {
    const decoder = new TextDecoder("utf-8");
    const data = await Deno.readFile("hello_world.txt");
    assertEquals(decoder.decode(data), "Hello world");
  }
});

type

DenoTest