jest icon indicating copy to clipboard operation
jest copied to clipboard

Confusing red color for my custom runner

Open JoelEinbinder opened this issue 5 years ago • 5 comments

🐛 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?

JoelEinbinder avatar Apr 16 '20 09:04 JoelEinbinder

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?

SimenB avatar Apr 16 '20 10:04 SimenB

removing yellow, green and red SGTM

👍

thymikee avatar Apr 16 '20 10:04 thymikee

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.

jeysal avatar Apr 16 '20 11:04 jeysal

Related: https://github.com/facebook/jest/issues/9459

TheJaredWilcurt avatar Sep 09 '21 13:09 TheJaredWilcurt

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.

github-actions[bot] avatar Sep 09 '22 13:09 github-actions[bot]

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.

github-actions[bot] avatar Oct 09 '22 13:10 github-actions[bot]