You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If users use jest-preview with vite, CSS modules with SCSS and import stylesheet with an absolute import like this @import 'src/styles', the following error is thrown:
● Test suite failed to run.
Can't find stylesheet to import.
╷
1 │ @import 'src/styles';
│ ^^^^^^^^^^^^
╵
src\components\Button\Button.module.scss 1:9 root stylesheet
I attempted to utilize the sassLoadPaths configuration option and set up jest moduleNameMappers such as 'src/(.*)': '<rootDir>/src/$1', but it appears that none of these changes are taking effect.
Using a relative import could be a solution to the problem; however, implementing such a change in the existing project is not feasible.
Screenshots
Folder structure:
Import example:
Error:
Reproduce
You can find a minimal reproducible example in this repository, and its code is adapted from the example demonstrated in jest-preview vite-react-example.
Expected behavior
No errors
Environment
OS: Windows 11
jest: ^27.5.1
jest-preview: ^0.3.1
postcss: ^8.4.16
sass: ^1.50.0
vite: ^2.8.0
Additional context
Seems that the same issue was already reported in #224 without further resolution.
The text was updated successfully, but these errors were encountered:
Describe the bug
If users use
jest-preview
withvite
,CSS modules
withSCSS
and import stylesheet with an absolute import like this@import 'src/styles'
, the following error is thrown:I attempted to utilize the sassLoadPaths configuration option and set up jest moduleNameMappers such as
'src/(.*)': '<rootDir>/src/$1'
, but it appears that none of these changes are taking effect.Using a relative import could be a solution to the problem; however, implementing such a change in the existing project is not feasible.
Screenshots
Folder structure:
Import example:
Error:
Reproduce
You can find a minimal reproducible example in this repository, and its code is adapted from the example demonstrated in jest-preview vite-react-example.
Expected behavior
No errors
Environment
Additional context
Seems that the same issue was already reported in #224 without further resolution.
The text was updated successfully, but these errors were encountered: