beater
TypeScript icon, indicating that this package has built-in type declarations

9.0.1 • Public • Published

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/)

Package Sidebar

Install

npm i beater

Weekly Downloads

20

Version

9.0.1

License

MIT

Unpacked Size

15 kB

Total Files

16

Last publish

Collaborators

  • bouzuya