-
-
Notifications
You must be signed in to change notification settings - Fork 149
Description
-
I am using Jest and Enzyme to write unit test cases for react app. In those unit test files, where we have import statements for Material Table, the complete test suit is failing. The error message provided by Jest is below:
Test suite failed to run
Jest encountered an unexpected token
This usually means that you are trying to import a file that Jest cannot parse, e.g. it's not plain JavaScript. -
I checked the next recent version 4..0.0, the issue persists there too. But with version 3.2.5, all tests were passing. See the below screenshot for more detail.
As the error message suggests possible solutions for the failing tests. I applied 2nd point from the "what you can do" section (Image 2) and added "material-core/table" in the transformIgnorePatterns property in the package.json file. The tests are passing with this change.
So, why do we need to add it to transformIgnorePatterns for tests to work?
Desktop (please complete the following information):
- OS: Windows 10
- Browser: NA
- React version: 16.13.1
- Material-Table/Core - 4.0.1
- Jest: 26.6.3

