https://github.com/joseluisq/briefest
Small and fast Typescript unit testing library with no dependencies. [WIP]
https://github.com/joseluisq/briefest
browser library nodejs testing typescript unit-testing
Last synced: about 1 year ago
JSON representation
Small and fast Typescript unit testing library with no dependencies. [WIP]
- Host: GitHub
- URL: https://github.com/joseluisq/briefest
- Owner: joseluisq
- License: mit
- Created: 2020-02-25T21:56:58.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-02-26T08:18:57.000Z (over 6 years ago)
- Last Synced: 2024-04-22T14:23:11.971Z (about 2 years ago)
- Topics: browser, library, nodejs, testing, typescript, unit-testing
- Language: TypeScript
- Homepage:
- Size: 43 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Briefest [](https://www.npmjs.com/package/briefest) [](https://www.npmjs.com/package/briefest) [](https://travis-ci.com/joseluisq/briefest) [](http://standardjs.com/)
> Small and fast [Typescript](https://www.typescriptlang.org/) [unit testing](https://en.wikipedia.org/wiki/Unit_testing) library with no dependencies.

## Install
[Yarn](https://github.com/yarnpkg/)
```sh
yarn add briefest --dev
```
[NPM](https://www.npmjs.com/)
```sh
npm install briefest --save-dev
```
[UMD](https://github.com/umdjs/umd/) file is also available on [unpkg](https://unpkg.com):
```html
```
You can use the library via `window.briefest`.
## Usage
### Simple tests
```ts
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
```ts
import { test } from "briefest"
const callbackTest = (func: (n: number) => void) => setTimeout(() => func(500), 200)
const asyncTest = () => new Promise((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](https://github.com/joseluisq/briefest/pulls) or [issue](https://github.com/joseluisq/briefest/issues).
## License
MIT license
© 2020 [Jose Quintana](http://git.io/joseluisq)