Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatible with chalk@5 #43

Closed
kopach opened this issue Nov 21, 2023 · 4 comments · Fixed by #44
Closed

Incompatible with chalk@5 #43

kopach opened this issue Nov 21, 2023 · 4 comments · Fixed by #44

Comments

@kopach
Copy link
Contributor

kopach commented Nov 21, 2023

I have chalk@5 in my project. When I run tests with jest-fail-on-console enabled — I'm getting errors like TypeError: chalk.red is not a function

There is also an issue with package.json of jest-fail-on-console. It doesn't specify chalk in peerDependency 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

It's totally fine to stay on Chalk v4. It's been stable for years.

So, just update to package.json of jest-fail-on-console to include chalk@4 in peerDependency would be enough

@kopach
Copy link
Contributor Author

kopach commented Nov 21, 2023

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

@kopach kopach closed this as completed Nov 21, 2023
@kopach kopach reopened this Nov 21, 2023
@ValentinH
Copy link
Owner

chalk V4 is declared as a dependency so it should be installed regardless of the version you are using.

@kopach
Copy link
Contributor Author

kopach commented Nov 22, 2023

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

@ValentinH
Copy link
Owner

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?

kopach added a commit to kopach/jest-fail-on-console that referenced this issue Nov 22, 2023
kopach added a commit to kopach/jest-fail-on-console that referenced this issue Nov 22, 2023
kopach added a commit to kopach/jest-fail-on-console that referenced this issue Nov 22, 2023
kopach added a commit to kopach/jest-fail-on-console that referenced this issue Nov 22, 2023
kopach added a commit to kopach/jest-fail-on-console that referenced this issue Nov 22, 2023
ValentinH pushed a commit that referenced this issue Nov 22, 2023
* refactor: ➖ remove `chalk` as dependency

fixes: #43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants