UNPKG

643 BJavaScriptView Raw
1// UNIT TEST ENTRY POINT
2// =============================================================================
3
4const Mocha = require('mocha');
5const fs = require('fs');
6const path = require('path');
7
8const mocha = new Mocha();
9
10const loadTestDir = (dirPath) => {
11 const workingPath = path.join(__dirname, dirPath);
12
13 fs.readdirSync(workingPath).filter(file =>
14 file.endsWith('.js'),
15 ).forEach((file) => {
16 mocha.addFile(path.join(workingPath, file));
17 });
18};
19
20// LOAD TESTS
21loadTestDir('./generators');
22loadTestDir('./utility');
23
24// RUN TESTS
25mocha.run((failures) => {
26 process.on('exit', () => {
27 process.exit(failures);
28 });
29});