Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including @vangware/test with all npm packages installed. Try it out:

require("uvu/package.json"); // uvu is a peer dependency. var test = require("@vangware/test")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

@vangware/test v2.0.3

uvu test wrapper that enforces legibility

@vangware/test

License NPM Version Open Issues Size

Wrapper of uvu that enforces legibility (based on RITEway).

Usage

import { test } from "@vangware/test"; // or: import test from "@vangware/test";

const add = (addend2: number) => (addend1: number) => addend1 + addend2;

test([
    {
        given: "a 1 and a 2",
        must: "return 3",
        received: add(2)(1),
        wanted: 3
    },
    {
        given: "a 1 and a -2",
        must: "return -1",
        received: add(-2)(1),
        wanted: -1
    }
]);

If let's say the first test fails, the error reads something like this:

[FAIL] Given a 1 and a 2, must return 3.
    ++3    (Expected)
    --4    (Actual)

Future

In the near future, this library will move away from uvu to just have equality assertions.

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free