Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gcaptn/tincan

A BDD testing library for Deno
https://github.com/gcaptn/tincan

bdd deno testing

Last synced: 25 days ago
JSON representation

A BDD testing library for Deno

Awesome Lists containing this project

README

        



tincan

A lightweight Jest-like testing library for Deno


ci
CodeFactor

deno.land/x

## Features

- Nested suites / cases
- Reports cases with the full hierarchy
- Hooks (`beforeAll`, `afterAll`, `beforeEach`, `afterEach`)
- Focusing (`*.only()`)
- Skipping (`*.skip()`)
- Uses `Deno.test`, works with the built-in reporter
- Lightweight

## Running

```sh
deno test
```

## Usage

```ts
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 the first index of an item", () => {
array.push(0);
expect(array.indexOf(0)).toBe(0);
});

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

run();
```