Skip to content

Commit b189ea9

Browse files
edgardmessiasJohnstonCode
authored andcommitted
test: Fixed Mocha deprecated warning (#520)
1 parent 0372744 commit b189ea9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/test/istanbultestrunner.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,18 @@ if (!tty.getWindowSize) {
2727
}
2828

2929
let mocha = new Mocha({
30-
ui: "tdd",
31-
useColors: true
30+
ui: "tdd"
3231
});
3332

3433
let testOptions: any;
3534

3635
export function configure(mochaOpts: Mocha.MochaOptions, testOpts: any): void {
36+
// For Mocha >= 6.0.0, `useColors` is deprecated
37+
const color = mochaOpts.useColors || (<any>mochaOpts).color || false;
38+
delete mochaOpts.useColors;
39+
3740
mocha = new Mocha(mochaOpts);
41+
mocha.useColors(color);
3842
testOptions = testOpts;
3943
}
4044

0 commit comments

Comments
 (0)