| 42 | } |
| 43 | |
| 44 | function runMocha() { |
| 45 | let ROOT = process.cwd(); |
| 46 | |
| 47 | /* SilentErrors are used to avoid unhelpful stack traces to users but they can hide the source of test failures in |
| 48 | reporter output */ |
| 49 | process.env.SILENT_ERROR = 'verbose'; |
| 50 | |
| 51 | // ensure that at the end of every test, we are in the correct current |
| 52 | // working directory |
| 53 | mocha.suite.afterEach(function () { |
| 54 | expect(process.cwd()).to.equal(ROOT); |
| 55 | }); |
| 56 | |
| 57 | console.time('Mocha Tests Running Time'); |
| 58 | mocha.run((failures) => { |
| 59 | console.timeEnd('Mocha Tests Running Time'); |
| 60 | |
| 61 | // eslint-disable-next-line n/no-process-exit |
| 62 | process.exit(failures); |
| 63 | }); |
| 64 | } |
| 65 | |
| 66 | Promise.resolve() |
| 67 | .then(() => runMocha()) |