tscoverage/ts/npmts.tests.ts

30 lines
860 B
TypeScript
Raw Normal View History

2016-01-30 03:57:24 +00:00
/// <reference path="./index.ts" />
module NpmtsTests {
2016-01-30 04:29:54 +00:00
export var run = function() {
var done = plugins.q.defer();
plugins.beautylog.info("Now running mocha tests");
2016-01-30 03:57:24 +00:00
// Instantiate a Mocha instance.
var mocha = new plugins.mocha();
2016-01-30 04:29:54 +00:00
var testDir = paths.testDir;
2016-01-30 03:57:24 +00:00
// Add each .js file to the mocha instance
plugins.fs.readdirSync(testDir).filter(function(file){
// Only keep the .js files
return file.substr(-3) === '.js';
}).forEach(function(file){
mocha.addFile(
plugins.path.join(testDir, file)
);
});
// Run the tests.
mocha.run(function(failures){
process.on('exit', function () {
process.exit(failures);
});
});
2016-01-30 04:29:54 +00:00
return done.promise;
2016-01-30 03:57:24 +00:00
}
}