Closed kopach closed 7 months ago
sorry, my mistake, I had chalk
mocked under __mocks__
folder which caused all the issues for me, anyway still doesn't work with chalk@5
chalk V4 is declared as a dependency so it should be installed regardless of the version you are using.
I see. Btw, how about to get rid of chalk
as a dependency at all? There is no much usage of it, special characters to color output can be hard coded. The problem with chalk
(apart of forcing users to install it) is that it's widely used and in some cases we actually want to mock it in tests (as I mentioned above) as it's external dependency. But if we mock it - jest-fail-on-console
would also stop working :(
What do you think @ValentinH ? Let me know if you need help with this
I get the point. I have zero knowledge on this topic but I would be happy to review a PR removing chalk and hardcoding the tokens.
Would it work on windows as well?
I have chalk@5 in my project. When I run tests with
jest-fail-on-console
enabled — I'm getting errors likeTypeError: chalk.red is not a function
There is also an issue with
package.json
ofjest-fail-on-console
. It doesn't specifychalk
inpeerDependency
section, therefore required for project chalk version is neither validated during install nor installed.update
Just found docs on chalk v5 breaking changes https://github.com/chalk/chalk/releases/tag/v5.0.0 and there are stated
So, just update to
package.json
ofjest-fail-on-console
to include chalk@4 inpeerDependency
would be enough