jprichardson / electron-mocha

Run Mocha tests in Electron
MIT License
346 stars 64 forks source link

Mocha colored-reporters support #162

Open marc2332 opened 4 years ago

marc2332 commented 4 years ago

I have been trying for my self, but I can't get working any colored mocha reporter, I mean, it displays the text, but not the colors.

I know electron-mocha uses https://nodejs.org/dist/latest-v12.x/docs/api/console.html to print in to the main process, but it doesn't print the colors.

Any thoughts on this?

inukshuk commented 4 years ago

What Terminal do you use? I have no issues getting colored output from mocha reporters using various Terminals on Linux, Mac OS and Windows. The CI reports of the project also have colors on all three platforms.

marc2332 commented 4 years ago

I am using Windows Terminal Preview ( I have also tried with CMD ).

Here is a project using mocha directly:

imagen

And here my project using electron-mocha:

imagen

Both of them use the same reporter, but with electron-mocha, it doesn't output the colors, I have also tried other themes and happens the same.

My project is https://github.com/Graviton-Code-Editor/Graviton-App in case you want to try it by yourself

xmedeko commented 3 years ago

It's probably bug of Electron on Windows, see electron/electron#15727 (closed) and electron/electron#27170 (active).

julianhille commented 3 years ago

i've got the same locally on linux. No colors.

when printing exports.useColors from mocha it says true, but when looking at exports.useColors in the color function (just before test reporter output) it is false.