🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

briefest

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

briefest

Small and fast Typescript unit testing library with no dependencies

0.0.1-beta.1
latest
Source
npm
Version published
Maintainers
1
Created
Source

Briefest npm npm Build Status js-standard-style

Small and fast Typescript unit testing library with no dependencies.

Testing using Briefest

Install

Yarn

yarn add briefest --dev

NPM

npm install briefest --save-dev

UMD file is also available on unpkg:

<script src="https://unpkg.com/briefest/briefest.umd.min.js"></script>

You can use the library via window.briefest.

Usage

Simple tests

import { test } from "briefest"

test("Simple tests", (t, done) => {
    t.isPrimitive(-1)
    t.isPrimitive(2n ** 8n)

    t.isEqualPrimitive(undefined, undefined)

    t.isEqual("", "")
    t.isEqual(64n, 2n ** 6n)

    t.isNotEqual({}, {})
    t.isNotEqual(new Date(), new Date())

    done()
})

Asynchronous tests

import { test } from "briefest"

const callbackTest = (cb: (v: number) => void) => setTimeout(() => cb(500), 200)
const asyncTest = () => new Promise<number>((resolve) => setTimeout(() => resolve(600), 100))

test("Async tests", (t, done) => {
    callbackTest(async (val) => {
        t.isEqual(500, val)

        // an async/await example
        t.isEqual(600, await asyncTest())

        done()
    })
})

Contributions

Feel free to send some pull request or issue.

License

MIT license

© 2020 Jose Quintana

Keywords

unit-testing

FAQs

Package last updated on 25 Feb 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts