Skip to content

Snapshot produced by toThrowErrorMatchingSnapshot might not match on CI #4407

Closed
@okonet

Description

@okonet

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. using chalk) 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-bdc504f1ee32ed7f1704def433667f72R223

This 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 and yarn test.

git clone [email protected]:okonet/lint-staged.git
cd lint-staged && npm install && npm 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions