beater: bouzuya's easy test runner. beater is inspired by eater.
Features
- Only 2 functions:
run()
runWithOptions()
- You can use your favorite
assert()
. - You can use your favorite reporter.
- You can use TypeScript (3.x
*.d.ts
is included).
Usage
1. Install
$ npm install --save-dev beater
2. Write test
// test/index.js
const assert = require('assert');
const { run } = require('beater');
const test1 = function simple_test() {
assert(1 === 1);
};
const test2 = function promise_test() {
return new Promise((resolve) => {
assert(1 === 1);
resolve();
});
};
const test3 = async function async_fn_test() {
await new Promise((resolve) => setTimeout(resolve, 0));
assert(1 === 1);
};
run([test1, test2, test3]).catch(() => process.exit(1));
3. Run
$ node test/index.js
TAP version 13
1..3
ok 1 - simple_test
ok 2 - promise_test
ok 3 - async_fn_test
Related Packages
- bouzuya/beater-helpers ... beater helper functions.
- bouzuya/beater-reporter ... beater reporter interface.
- bouzuya/beater-tap-reporter ... beater TAP reporter (default reporter) .
- You can pipe to any TAP reporter.
- e.g.
$ node test/index.js | tap-dot
- bouzuya/create-beater-index ... beater index generator.
- bouzuya/beater-double ... beater test double functions (alpha) .
- bouzuya/beater-snapshot ... beater snapshot testing functions (alpha) .
bouzuya/beater-cli ... DEPRECATED. A command-line interface for beater.bouzuya/beater-cli-reporter ... DEPRECATED. beater-cli default reporter.