A Jest script processor that prevents CSS module parse errors.
npm install --save-dev jest-css-modules
Update your package.json file's jest
configuration:
{
"jest": {
"scriptPreprocessor": "<rootDir>/node_modules/jest-css-modules",
}
}
Now, imports such as import styles from './MyModule.css';
will pass through Jest without causing any pain.
Supports .css
, .less
, and .scss
extensions.