eatest
Version:
test function for eater
72 lines (51 loc) • 1.66 kB
Markdown
[](https://travis-ci.org/mohayonao/eatest)
[](https://www.npmjs.org/package/eatest)
[](http://mohayonao.mit-license.org/)
test function for [eater](https://github.com/yosuke-furukawa/eater)
- can run a test file directly on the editor / [atom-runner](https://atom.io/packages/atom-runner)
- each subtests also run in a single process, so faster then `(eater/runner).test`
```
npm install -D eater eatest
```
```js
// 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 */ });
});
```
```
$ eater test/example.js
```

- `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`
MIT