eatest

1.0.0 • Public • Published

eatest

Build Status NPM Version License

test function for eater

Features

  • can run a test file directly on the editor / atom-runner
  • each subtests also run in a single process, so faster then (eater/runner).test

How to use

1. Install

npm install -D eater eatest

2. Write tests

// test/example.js
const assert = require("assert");
const test = require("eatest");
 
test("success", () => {
  assert(true);
});
 
test("failure", () => {
  assert(false);
});
 
test("async/success", () => {
  return Promise.resolve(true);
});
 
test("async/failure", () => {
  return Promise.reject(new TypeError("async/failure"));
});
 
test.timeout = 100; // default timeout is 2000ms
test("async/timeout", () => {
  return new Promise(() => { /* noop */ });
});

3. Run

$ eater test/example.js

screenshot

API

  • test(name: string, testfn: function)
  • test.skip(name: string, testfn: function)
    • skip the test
  • test.only(name: string, testfn: function)
    • exclude other tests in the same test file
  • test.fork(name: string, testfn: function)
    • run the test in a child process. it is useful to avoid side effect in the test.
  • test.timeout: number

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i eatest

Weekly Downloads

4

Version

1.0.0

License

MIT

Last publish

Collaborators

  • mohayonao