forked from ThePalaceProject/circulation-admin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
testReporter.js
31 lines (25 loc) · 819 Bytes
/
testReporter.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* eslint-disable @typescript-eslint/no-var-requires */
const mocha = require("mocha");
const sinon = require("sinon");
const color = require("colors-cli/safe");
function TestReporter(runner) {
// This isn't the place for warnings about soon-to-be-deprecated React methods, etc; we just want a clean list.
console.warn = sinon.stub();
console.error = sinon.stub();
const {
EVENT_SUITE_BEGIN,
EVENT_TEST_BEGIN,
EVENT_SUITE_END,
} = mocha.Runner.constants;
mocha.reporters.Base.call(this, runner);
runner.on(EVENT_SUITE_BEGIN, function (suite) {
console.group(color.x25.bold(suite.title));
});
runner.on(EVENT_TEST_BEGIN, function (test) {
console.log(test.title);
});
runner.on(EVENT_SUITE_END, function () {
console.groupEnd();
});
}
module.exports = TestReporter;