|
1 | | -///* eslint-disable @typescript-eslint/ban-ts-comment */ |
2 | | -///* eslint-disable @typescript-eslint/no-unsafe-member-access */ |
3 | | -///* eslint-disable @typescript-eslint/no-unsafe-call */ |
| 1 | +/* eslint-disable @typescript-eslint/ban-ts-comment */ |
| 2 | +/* eslint-disable @typescript-eslint/no-unsafe-member-access */ |
| 3 | +/* eslint-disable @typescript-eslint/no-unsafe-call */ |
4 | 4 |
|
5 | | -//import * as path from 'path'; |
6 | | -//import * as Mocha from 'mocha'; |
7 | | -//import { glob } from 'glob'; |
| 5 | +import * as path from 'path'; |
| 6 | +import * as Mocha from 'mocha'; |
| 7 | +import { glob } from 'glob'; |
8 | 8 |
|
9 | | -//export function run(): Promise<void> { |
10 | | -// // Create the mocha test |
11 | | -// const mocha = new Mocha({ |
12 | | -// ui: 'tdd', |
13 | | -// color: true |
14 | | -// }); |
| 9 | +export function run(): Promise<void> { |
| 10 | + // Create the mocha test |
| 11 | + const mocha = new Mocha({ |
| 12 | + ui: 'tdd', |
| 13 | + color: true |
| 14 | + }); |
15 | 15 |
|
16 | | -// const testsRoot = path.resolve(__dirname, '..'); |
| 16 | + const testsRoot = path.resolve(__dirname, '..'); |
17 | 17 |
|
18 | | -// return new Promise((c, e) => { |
19 | | -// glob('**/**.test.js', { cwd: testsRoot }) |
20 | | -// .then(files => { |
21 | | -// // Add files to the test suite |
22 | | -// files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); |
| 18 | + return new Promise((c, e) => { |
| 19 | + glob('**/**.test.js', { cwd: testsRoot }) |
| 20 | + .then(files => { |
| 21 | + // Add files to the test suite |
| 22 | + files.forEach(f => mocha.addFile(path.resolve(testsRoot, f))); |
23 | 23 |
|
24 | | -// try { |
25 | | -// // Run the mocha test |
26 | | -// mocha.run(failures => { |
27 | | -// if (failures > 0) { |
28 | | -// e(new Error(`${failures} tests failed.`)); |
29 | | -// } else { |
30 | | -// c(); |
31 | | -// } |
32 | | -// }); |
33 | | -// } catch (err) { |
34 | | -// e(err); |
35 | | -// } |
36 | | -// }) |
37 | | -// .catch(err => { |
38 | | -// return e(err); |
39 | | -// }); |
40 | | -// }); |
41 | | -//} |
| 24 | + try { |
| 25 | + // Run the mocha test |
| 26 | + mocha.run(failures => { |
| 27 | + if (failures > 0) { |
| 28 | + e(new Error(`${failures} tests failed.`)); |
| 29 | + } else { |
| 30 | + c(); |
| 31 | + } |
| 32 | + }); |
| 33 | + } catch (err) { |
| 34 | + e(err); |
| 35 | + } |
| 36 | + }) |
| 37 | + .catch(err => { |
| 38 | + return e(err); |
| 39 | + }); |
| 40 | + }); |
| 41 | +} |
0 commit comments