Skip to content

Commit a7fb212

Browse files
test: fix
1 parent f5de67a commit a7fb212

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

test/helpers/getCodeFromSass.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,10 @@ async function getCodeFromSass(testId, options, context = {}) {
452452
testFolder,
453453
"node_modules/webpack-export-field/dist/styles/webpack/file.scss",
454454
);
455+
const pathToCSSModule = path.resolve(
456+
testFolder,
457+
"node_modules/css/some-css-module.css",
458+
);
455459

456460
// Pseudo importer for tests
457461
const testImporter = function testImporter(url) {
@@ -858,7 +862,6 @@ async function getCodeFromSass(testId, options, context = {}) {
858862
}
859863
}
860864
}
861-
862865
// eslint-disable-next-line no-param-reassign
863866
url = url
864867
.replace(
@@ -939,6 +942,14 @@ async function getCodeFromSass(testId, options, context = {}) {
939942
.replace(/^~/, testNodeModules);
940943
}
941944

945+
const { fromImport } = this;
946+
947+
if (!fromImport && /css\/some-css-module\.css/.test(url)) {
948+
return {
949+
file: url.replace(/css\/some-css-module\.css/, pathToCSSModule),
950+
};
951+
}
952+
942953
return {
943954
file: url,
944955
};
@@ -956,6 +967,7 @@ async function getCodeFromSass(testId, options, context = {}) {
956967
}
957968

958969
sassOptions.logger = { debug: () => {}, warn: () => {} };
970+
sassOptions.silenceDeprecations = ["legacy-js-api"];
959971

960972
let css;
961973
let map;

0 commit comments

Comments
 (0)