Open paul-vd opened 7 months ago
Just to add some context, I had similar tests working on 2.4.1, but after after migrating to 2.5.1 I see the same error given above when trying to import Link in my tests.
Any news on this? it seems like posting issues don't get much ❤️, I have some other issues posted since November without any feedback.
I ran into the same issue going from 2.2.0 -> 2.5.1 as part of our Hydrogen upgrade. On our end we solved this for now using a full jest mock of this package. Not ideal but it unblocks us for now. I'm also hoping for a more official solve here if that's possible.
@altonchaney can you maybe share your gist with your mock implementation?
Happening on 2.8.1 too
@paul-vd sorry for the delayed response, here's what I've come up with. https://gist.github.com/altonchaney/e7417468e9d42a1e5978e32b0cec19d7 Again, not ideal but it's working and we are able to update the mocks as needed
2.9.2 still not working
2.10.0 and same issue.
I tried downgrading the dependency version to 2.4.1 (as @caprica said it was working for them on that version), but it still doesn't work for me in that version (it's a peer dependency on a component library, and I only depend on the Link component for some tests, so I could have run the tests in 2.4 even if the actual code runs with the latest version).
I applied the fix that @altonchaney offered, but it would be good to not need mocks!
Reproduction
https://github.com/front-commerce/reproduction-remix-cjs-jest
System Info
Used Package Manager
pnpm
Expected Behavior
The test should pass.
Actual Behavior
When importing from @remix-run/react in a cjs project, the jest test fails with the following error: