-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Snapshot produced by toThrowErrorMatchingSnapshot might not match on CI #4407
Comments
I don't think there is anything we can really do about this… If your terminal supports colors in one place but not in another, then the output may differ and |
I'm happy to reopen if there is a proposal that will work consistently, and happy to merge PRs. |
You can however create a custom serializer which will strip the colors if they don't matter |
Oh yeah, that's a good solution, I like that one. |
@cpojer would you merge a PR for the default serializer that does that or adds an option? |
Nah, I think publishing that serializer in a separate package makes most sense to me. We can link to it from somewhere on the Jest docs, though (do we have a space for extensions to Jest there?). |
We should have a community section with known and reliable libs around Jest |
Agreed! |
Hi, I'm needing a serializer that performs exactly what was needed in this case, and I can't find it referenced in the docs. I found this community section and from there there's a link to "more resources" and to jest-awesome but I found no such serializer in those places. |
Ok we found one, and I'll link to it for future reference to others that pass by this issue: https://github.com/joaogranado/jest-serializer-ansi |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Using
.toThrowErrorMatchingSnapshot()
on code that prints error using ansi codes (i.e. usingchalk
) produces different snapshots if run locally or on CI.I'm running using
jest-validate
and here is the test I wrote for it: https://github.com/okonet/lint-staged/pull/141/files#diff-bdc504f1ee32ed7f1704def433667f72R223This test runs locally but fails on CI. See https://travis-ci.org/okonet/lint-staged/jobs/270725061
If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.This should be free of errors. Running same command on Travis CI will fail the build, though: https://travis-ci.org/okonet/lint-staged/jobs/270725061
What is the expected behavior?
Snapshots should match locally and on CI.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Default Jest config with
babel-jest
macOS 10.12.
node 8.1.3
npm 5.3.0
The text was updated successfully, but these errors were encountered: