Open
Description
When importing relative paths inside a stylesheet being made globally available using the option jest.globals['vue-jest'].resources
, the test will fail with the following error:
Considering the following
{
"jest": {
"globals": {
"vue-jest": {
"resources": {
"scss": [
"./src/styles/settings/breakpoints.scss",
"./src/styles/settings/colors.scss",
"./src/styles/settings/unit.scss",
],
}
}
}
}
}
src/styles/settings/breakpoints.scss
@import './unit.scss';
$breakpoint-mobile: 450px;
$breakpoint-tablet: 768px;
$breakpoint-desktop: 1200px;
:export {
mobile: strip-unit($breakpoint-mobile);
tablet: strip-unit($breakpoint-tablet);
desktop: strip-unit($breakpoint-desktop);
}
and considering that src/styles/settings/unit.scss exists, it should be able to find it.
Version
I'm using version 4.0.1
, but I had the same issue when downgrading to 3.0.7
.
Steps to reproduce
Run the test in this repository: https://github.com/pmrotule/vue-jest-global-resources-bug
Moreover, the test only started failing when I added CSS modules to HelloWorld.vue (<style lang="scss" module>
) so it seems to be both related to vue-jest
not resolving relative paths properly + using CSS modules.
Metadata
Metadata
Assignees
Labels
No labels