-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Unable to run Jest test - Cannot use import statement outside a module #5570
Comments
my explanation on this comment addresses this: #5467 (comment) |
I've ended up with mocking fullcalendar like this
Note that this will prevent fullcalendar from being rendered but test should be working fine - ofc if you don't need to test FC or even better, you can mock fullcalendar and it's API
|
Without mocking you can use // jest.config.js
module.exports = {
transform: {
'^.+\\.[t|j]sx?$': 'babel-jest'
},
moduleNameMapper: {
'\\.(css|less|sass|scss)$': 'identity-obj-proxy',
},
transformIgnorePatterns: [
'/node_modules/(?!@fullcalendar/*).+\\.[t|j]sx?$'
],
}; |
I used the solution from @marcobeltempo but I also had to switch from |
I started getting this after upgrading to jest v28 (from v26). None of the solutions in here worked for me...but I was able to get it to work using a solution from preactjs/enzyme-adapter-preact-pure#179 (comment) TL;DR
|
With latest v5.1.0 I am unable to run Jet tests.
I am using react-scripts (without ejecting). Is there any solution to get rid of this error?
The text was updated successfully, but these errors were encountered: