Open iamBevan opened 1 year ago
Hi, this is likely an issue with Jest configuration. AFAIK it has some issues with using ES modules.
The component has correct fields in package.json
indicating that is a ES module package:
Here is an example of using transformIgnorePatterns
with a set of packages, hope it helps.
Got it working by using one of the approaches from https://gist.github.com/rstacruz/511f43265de4939f6ca729a3df7b001c
Method A got rid of the issue by:
NODE_OPTIONS=--experimental-vm-modules
import("vanilla-colorful")
Thanks for sharing! I will try it myself and consider adding this solution to README. The only thing that looks confusing is the need for dynamic import.
@web-padawan I spoke too soon. When running jest in CI, getting memory leak.
Possibly the same issue as on either of these: https://github.com/facebook/jest/issues/11438 https://github.com/facebook/jest/issues/11956
Current Behavior
When trying to run Jest in a repo that is importing vanilla-colorful, I get the following error message: "Cannot use import statement outside a module"
Steps to Reproduce
Context (Environment)
Detailed Description
Currently I am importing vanilla-colorful in to a Vue project. When I try to run Jest I get the following error message:
I have tried what Jest suggests; adding experimental decorators and get the following message:
I have also tried tried adding vanilla-colorful as a custom transformIgnorePattern.
Any insight on this would be appreciated, thanks.