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

Locally linked repos do not have their components styles transformed #40

Closed
chrissinclairedited opened this issue Jul 23, 2018 · 3 comments

Comments

@chrissinclairedited
Copy link

chrissinclairedited commented Jul 23, 2018

  • jest-glamor-react version: 4.3.1
  • node version: 9.11.2
  • npm (or yarn) version: 6.1.0

What you did:
I have two repositories, one that contains a UI library using glamour and the other that contains our production site, also using glamor. Both are using the same version of jest-glamor-react. In our main repo, when we have the UI library installed normally, we see the styles come through on all components, and all is well. But when running npm link to symlink to a local copy of the UI library, components from that library no longer get transformed, and we just get data-css-hash in our snapshots for those components.

Reproduction repository:
https://github.com/chrissinclairedited/jest-glamor-react-issue-library
https://github.com/chrissinclairedited/jest-glamor-react-issue-client

Clone both and link client -> library (the dependency in client is expecting it to be called library) and the tests pass. But looking at the snapshots for the client, the test that depends on the library component doesn't include the styles.

Problem description:
Snapshots are not transforming css classes when the component exists in a locally linked repo.

Suggested solution:
Treat locally linked libraries the same way as locally installed ones and transform the styles on that repo.

@kentcdodds
Copy link
Owner

Hi there,

My guess is that you have two instances of the glamor module loaded in your tests. This isn't really something we can solve in this library I'm afraid. You'll have to make sure that the glamor your components are using I'd the same one this library if using.

I'm sorry we can't be more helpful. Good luck!

@chrissinclairedited
Copy link
Author

chrissinclairedited commented Jul 23, 2018

Thanks for the reply - what you say makes sense, and would explain this. Also agree it's probably not on this library to solve, and is part of the way npm handles dependencies. I'm not seeing a good way around it either at the moment which is a real shame. Thanks for your time at any rate.

I've updated the comment above to include the repos as I'd managed to pull them together, in case it's useful to anyone else.

@chrissinclairedited
Copy link
Author

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

2 participants