1 |
|
2 |
|
3 |
|
4 | const Mocha = require('mocha');
|
5 | const fs = require('fs');
|
6 | const path = require('path');
|
7 |
|
8 | const mocha = new Mocha();
|
9 |
|
10 | const 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 |
|
21 | loadTestDir('./generators');
|
22 | loadTestDir('./utility');
|
23 |
|
24 |
|
25 | mocha.run((failures) => {
|
26 | process.on('exit', () => {
|
27 | process.exit(failures);
|
28 | });
|
29 | });
|