Skip to content
This repository has been archived by the owner on Feb 10, 2024. It is now read-only.

bouzuya/beater

Repository files navigation

beater logo

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

Badges

npm version Travis CI

License

MIT

Author

bouzuya <m@bouzuya.net> (https://bouzuya.net/)