-
Notifications
You must be signed in to change notification settings - Fork 1
/
test-cli-task.js
30 lines (24 loc) · 961 Bytes
/
test-cli-task.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
const Mocha = require('mocha'),
fs = require('fs'),
path = require('path'),
glob = require('glob')
module.exports = function() {
// Instantiate a Mocha instance.
var mocha = new Mocha({});
// Turn off type checking for now
require("ts-node").register({ transpileOnly: true })
require("jsdom-global")(undefined, { url: "http://localhost" })
require('ignore-styles')
require("handlebars")
var files = glob.sync("test/**/*Tests.ts").concat(glob.sync("test/**/*Tests.tsx")).concat(glob.sync("test/**/*Tests.js"))
for (var file of files) {
mocha.addFile(file)
}
// Run the tests.
mocha.run(function(failures) {
process.exitCode = failures ? 1 : 0; // exit with non-zero status if there were failures
// Force exit
process.exit(process.exitCode);
});
}
// mocha -r -r $DIR/node_modules/ts-node/register -r $DIR/node_modules/jsdom-global/register --require ignore-styles --recursive "test/**/*Tests.ts"