Skip to main content

tincan

A lightweight Jest-like testing library for Deno

Features

  • Nested suites / cases
  • Hooks (beforeAll, afterAll, beforeEach, afterEach)
  • Focusing and skipping (*.only(), *.skip())
  • Colorful output
  • Lightweight

Running

deno run <file>
deno test -q

Usage

import {
  beforeEach,
  describe,
  expect,
  it,
  run,
} from "https://deno.land/x/tincan/mod.ts";

describe("Array", () => {
  let array: number[];

  beforeEach(() => {
    array = [];
  });

  describe("#indexOf", () => {
    it("should return -1 when the item isn't found", () => {
      expect(array.indexOf(0)).toBe(-1);
    });

    it("should return the index of the item", () => {
      array.push(0);
      expect(array.indexOf(0)).toBe(0);
    });
  });
});

run();