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

Loses display name with ts-jest #343

Open
brandonchinn178 opened this issue Jul 17, 2021 · 5 comments
Open

Loses display name with ts-jest #343

brandonchinn178 opened this issue Jul 17, 2021 · 5 comments

Comments

@brandonchinn178
Copy link

I'm trying to convert my tests to use ts-jest, since babel-jest doesn't do any typechecking. ts-jest has a mode that will use babel configuration, which will typecheck the code, compile the typescript into javascript, then pass the javascript to babel to finish transpiling.

It works for the most part, except my snapshots lose the nice display name

      <div
-       class="SongForm__FormField-sc-1n6uj49-1 jkpiQR"
+       class="sc-htpNat fUJRVs"
      >
        <label
          for="bpm"
        >
          BPM

The issue is that ts-jest will first compile

const FormField = styled.div`
  ...
`

into

const FormField = styled_components_1.default.div `
  ...
`

And it seems like this output fails the isStyled checks in the displayNameAndId function. I'm not sure if this is the reason, but there's a space added between div and the backtick.

It's not a big deal, but it would be great to get the display name working with ts-jest to get nicer snapshots.

@brandonchinn178
Copy link
Author

brandonchinn178 added a commit to brandonchinn178/worshipmate that referenced this issue Jul 17, 2021
@Dartv
Copy link

Dartv commented Jun 2, 2022

@brandonchinn178 I have the same issue. Have you figured it out?

@brandonchinn178
Copy link
Author

Nope

@kolesker
Copy link

kolesker commented Dec 8, 2023

@brandonchinn178 It's been a while I have the same issue and I was not able to migrate from Jest 26 to 29 because I face this issue. Have you sorted it out?

I have steps to reproduce here kulshekhar/ts-jest#4026

@EvgeniyT13
Copy link

I have this issue too(

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

No branches or pull requests

4 participants