Dark Mode

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Bug]: babel-plugin-styled-components is ignored/not working starting Jest 27 #406

Open
Open
[Bug]: babel-plugin-styled-components is ignored/not working starting Jest 27#406

Description

Version

2.1.4

Steps to reproduce

  1. Clone my repo https://github.com/kolesker/ts-jest-styled-display-name-bug
  2. Choose jest-26 or jest-29 paths to test
  3. npm install
  4. npm run test

Expected behavior

In jest 26 you get as snapshot:

"



"
`;

Actual behavior

In jest 29 you get as snapshot:

"



"
`;

Additional context

In the migration from Jest and ts-jest 26 to 29, all of our snapshots are breaking since displayName attribute of babel-styled-components plugin is being ignored. Actually, the issue was introduced when migrating from 26 to 27, but it wasn't solved in the latest 29 version.

The problem is display names in the classes are being completely ignored, while in runtime (non-test environment) it is working OK. Also the issue is only happening after moving out from v26.

Environment

System:
OS: macOS 13.6.2
CPU: (10) arm64 Apple M1 Pro
Binaries:
Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
npm: 9.8.1 - ~/.nvm/versions/node/v9.8.1/bin/npm

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