jest
jest copied to clipboard
Confusing red color for my custom runner
🐛 Bug Report
If your jest runner hashes to an unfortunate value, its test suites are marked with a red badge that at first glance looks like they are failing. I spent an hour trying to figure out what about my tests was failing.
To Reproduce
Have a runner named something that hashes to 'red' from https://github.com/facebook/jest/blob/master/packages/jest-config/src/color.ts#L21
Expected behavior
I don't think a test runner should show me red text unless something went wrong.
I can send a PR that removes red, green, and yellow from the colors that the test runner can hash, as each of those colors imply something about the tests. However that greatly increases the chances that two test runners will collide with the same color.
Through this I've learned about setting displayName: {color, name}, which is really cool. But this override is required by everyone that uses my runner, otherwise they will get a scary red name. I'd have to add a line about it in the docs. I'd rather just tweak my name until it hashes to cyan. If I could set the color from the runner itself that would be cool.
Maybe it would be simplest to just have one color for non-default runners? Or leave everything white by default?
Letting a runner set a default color makes sense to me. E.g. iOS runners might want some white thing and Android green.
I also don't think we should reuse any colors that the default reporter uses (even though it increases the chances of collisions), so removing yellow, green and red SGTM.
@jeysal @thymikee thoughts on this one?
removing yellow, green and red SGTM
👍
We could add black and gray instead, but I'm a bit sad that the color vibrance that people get by default will go away. Is the output really that bad? You get a red/green-background all-caps PASS/FAIL right next to the display name.
Re runner default colors, makes sense to me.
I guess this would be taken from something require('runnerPath').color or so.
Related: https://github.com/facebook/jest/issues/9459
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days.
This issue was closed because it has been stalled for 30 days with no activity. Please open a new issue if the issue is still relevant, linking to this one.