No description, website, or topics provided.
JavaScript
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
examples
images
lib
test
.babelrc
.eslintrc
.gitignore
.travis.yml
README.md
package.json

README.md

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