2.1.7 • Published 8 years ago
hi-test v2.1.7
HI-TEST
Simple test framework on Nodejs
FEATURES
It's very simple. This is all
INSTALLATION
$ npm install hi-test
USAGE
COMMAND
Usage:
hi-test <files> [-d] [-a] [-f <title>]
Options:
+scan <path> Scan module exports
-f, --filter <title> Filter the output
-d, --debug Display all output
-a, --auto Automation
-v, --version Display version
-h, --help Display help
API
test(title, hash, func) Start a test, if the func is async function, then the test call done
test.enable() If enable, the unprotected output will be masked
- test.enableGC() Enable node --expose-gc
- test.log(...args)
- test.gc(obj, desc) Test obj release
- class Tester
- Tester.prototype.log(...args)
- Tester.prototype.logp(...args) More detailed output
- Tester.prototype.warn(...args)
- Tester.prototype.error(...args)
- Tester.prototype.gc(obj, desc)
- Tester.prototype.run(func) Non-blocking execution
- Tester.prototype.done() This method is automatic call
EXAMPLE
var test = require('hi-test').enable().enableGC();
let arr = [1, 2, 3];
test('No.1', (t) => {
t.log('Hello, Iam No.1');
t.gc(arr);
});
test('No.2', (t) => {
t.log('Hello, Iam No.2');
t.gc(arr);
arr = null;
});
Non-blocking
var test = require('hi-test').enable();
test('No.1').run((t) => {
setTimeout(() => {
t.log('Hello, Iam No.1');
}, 1000);
});
test('No.2').run((t) => {
t.log('Hello, Iam No.2');
});