Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/prantlf/tehanu
Blazingly fast, tiny and simple JavaScript test framework with pluggable reporters and an optional runner.
https://github.com/prantlf/tehanu
test test-framework test-harness test-runner testing testing-framework unit-testing
Last synced: 2 days ago
JSON representation
Blazingly fast, tiny and simple JavaScript test framework with pluggable reporters and an optional runner.
- Host: GitHub
- URL: https://github.com/prantlf/tehanu
- Owner: prantlf
- License: mit
- Created: 2021-05-08T23:02:40.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-05-26T18:05:53.000Z (5 months ago)
- Last Synced: 2024-10-19T09:07:46.995Z (16 days ago)
- Topics: test, test-framework, test-harness, test-runner, testing, testing-framework, unit-testing
- Language: JavaScript
- Homepage:
- Size: 687 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
- License: LICENSE
Awesome Lists containing this project
- awesome-blazingly-fast - tehanu - Blazingly fast, tiny and simple JavaScript test framework with pluggable reporters and an optional runner. (JavaScript)
README
## Test Harness Ultra
[![Latest version](https://img.shields.io/npm/v/tehanu)](https://www.npmjs.com/package/tehanu)
[![Dependency status](https://img.shields.io/librariesio/release/npm/tehanu-teru)](https://www.npmjs.com/package/tehanu-teru)[Blazingly fast](./benchmarks#readme), tiny and simple JavaScript test framework for both Node.js and the browser with pluggable reporters and an optional runner.
* Tiny size - 2.04 kB minified, 1 kB gzipped, 886 B brotlied (UMD).
* Zero dependencies.
* ESM, CJS and UMD support for Node.js and web browser.
* TypeScript declarations included.See the documentation of the [packages](#packages) for more information.
## Synopsis
CJS:
```js
const test = require('tehanu')('sum'),
{ equal } = require('assert'),
sum = require('./sum')test('one number', () => equal(sum(1), 1))
test('two numbers', () => equal(sum(1, 2), 3))
```ESM in Node.js:
```js
import tehanu from 'tehanu'
import { equal } from 'assert'
import sum from './sum.mjs'const test = tehanu('sum')
test('one number', () => equal(sum(1), 1))
test('two numbers', () => equal(sum(1, 2), 3))
```ESM in Node.js (unnamed suite):
```js
import test from 'tehanu/suite'
import { equal } from 'assert'
import sum from './sum.mjs'test('one number', () => equal(sum(1), 1))
test('two numbers', () => equal(sum(1, 2), 3))
```UMD in browser:
```html
const test = tehanu('sum'),
{ equal } = tehanuTeastest('one number', () => equal(sum(1), 1))
test('two numbers', () => equal(sum(1, 2), 3))```
ESM in browser:
```html
import test from './node_modules/tehanu/dist/suite.min.mjs?name=sum'
import './node_modules/tehanu-repo-tape/dist/index.min.mjs'
import { equal } from './node_modules/tehanu-teas/dist/index.min.mjs'
import sum from './sum.mjs'test('one number', () => equal(sum(1), 1))
test('two numbers', () => equal(sum(1, 2), 3))```
## Installation
You can install the [test harness](./packages/index#readme), typically with a chosen reporter like the [colourful console](./packages/coco#readme) or [tap](./packages/tape#readme), and optionally with the [command-line runner](./packages/teru#readme), using your favourite Node.js package manager:
```sh
npm i -D tehanu tehanu-repo-coco tehanu-teru
yarn add -D tehanu tehanu-repo-coco tehanu-teru
pnpm i -D tehanu tehanu-repo-coco tehanu-teru
```## Packages
* [tehanu](./packages/index#readme) - a framework for creation and execution of test suites.
* [teas](./packages/teas#readme) - a set of assertion methods compatible with the [built-in `assert` module] usable in both Node.js and the browser.
* [tenbo](./packages/tenbo#readme) - an experimental test runner for tests written with `tehanu` in the web browser.
* [teru](./packages/teru#readme) - an optional test runner for tests written with `tehanu`.
* [coco](./packages/coco#readme) - a colourful console reporter.
* [tape](./packages/tape#readme) - a reporter compatible with the [TAP] format specification.## Contributing
In lieu of a formal styleguide, take care to maintain the existing coding style. Lint and test your code using `npm test`.
## License
Copyright (c) 2021-2024 Ferdinand Prantl
Licensed under the MIT license.
[built-in `assert` module]: https://nodejs.org/api/assert.html
[TAP]: https://node-tap.org/tap-protocol/