-
Notifications
You must be signed in to change notification settings - Fork 3
/
index.js
37 lines (34 loc) · 901 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict'
var IS_BROWSER = require('is-browser');
if (!IS_BROWSER) {
var r = require;
var wtfnode = (r)('wtfnode');
}
var Suite = require('./lib/suite');
var defaultSuite = new Suite();
defaultSuite.addLogging();
defaultSuite.addExit();
var runTriggered = false;
function it(name, fn, options) {
defaultSuite.addTest(name, fn, options);
if (!runTriggered) {
runTriggered = true;
setTimeout(function () {
defaultSuite.run().done(function () {
if (!IS_BROWSER) {
setTimeout(function () {
wtfnode.dump();
}, 5000).unref()
}
});
}, 0);
}
}
function run(fn, options) {
defaultSuite.addCode(fn, options);
}
module.exports = it
module.exports.run = run;
module.exports.disableColors = defaultSuite.disableColors.bind(defaultSuite);
module.exports.on = defaultSuite.on.bind(defaultSuite);
module.exports.Suite = Suite;