4.5
Version:
Monadic test assertions
24 lines (15 loc) • 482 B
text/typescript
import * as Mocha from 'mocha';
import * as expand from 'glob-expand';
import { join } from 'path';
const mocha = new Mocha();
let testPaths = process.argv.slice(2);
if (testPaths.length === 0)
testPaths = ['src/**/*.test.ts', 'src/*.test.ts'];
const cwd = join(__dirname, '..');
const files = expand({ filter: 'isFile', cwd }, testPaths);
files.forEach(file => {
mocha.addFile(join(cwd, file));
});
mocha.run(function (failures: number) {
process.exit(failures);
});