Skip to content

Commit 008f9a6

Browse files
committed
fix: update snapshots with universal path
1 parent 187f97f commit 008f9a6

File tree

3 files changed

+40
-32
lines changed

3 files changed

+40
-32
lines changed

src/utils.js

-2
Original file line numberDiff line numberDiff line change
@@ -593,8 +593,6 @@ function getModulesOptions(rawOptions, exportType, loaderContext) {
593593
? "camelCaseOnly"
594594
: "asIs",
595595
exportOnlyLocals: false,
596-
// eslint-disable-next-line no-undefined
597-
getJSON: undefined,
598596
...rawModulesOptions,
599597
useExportsAs: rawModulesOptions.exportLocalsConvention === "asIs",
600598
};

test/__snapshots__/modules-option.test.js.snap

+28-28
Original file line numberDiff line numberDiff line change
@@ -1186,7 +1186,7 @@ Array [
11861186
"replacementName": "___CSS_LOADER_ICSS_IMPORT_1_REPLACEMENT_1___",
11871187
},
11881188
],
1189-
"resourcePath": "/Users/skao/workspace/webpack-contrib/css-loader/test/fixtures/modules/getJSON/source.css",
1189+
"resourcePath": "<ROOT_DIR>/test/fixtures/modules/getJSON/source.css",
11901190
},
11911191
],
11921192
Array [
@@ -1209,7 +1209,7 @@ Array [
12091209
},
12101210
],
12111211
"replacements": Array [],
1212-
"resourcePath": "/Users/skao/workspace/webpack-contrib/css-loader/test/fixtures/modules/getJSON/composeSourceB.css",
1212+
"resourcePath": "<ROOT_DIR>/test/fixtures/modules/getJSON/composeSourceB.css",
12131213
},
12141214
],
12151215
Array [
@@ -1236,7 +1236,7 @@ Array [
12361236
},
12371237
],
12381238
"replacements": Array [],
1239-
"resourcePath": "/Users/skao/workspace/webpack-contrib/css-loader/test/fixtures/modules/getJSON/composeSourceC.css",
1239+
"resourcePath": "<ROOT_DIR>/test/fixtures/modules/getJSON/composeSourceC.css",
12401240
},
12411241
],
12421242
]
@@ -1344,6 +1344,29 @@ exports[`"modules" option should invoke the custom getJSON function with getJSON
13441344

13451345
exports[`"modules" option should invoke the custom getJSON function with getJSON as an asynchronous function: args 1`] = `
13461346
Array [
1347+
Array [
1348+
Object {
1349+
"exports": Array [
1350+
Object {
1351+
"name": "composedB",
1352+
"value": "gFdUXtR3F_6oyBd_qgU8",
1353+
},
1354+
],
1355+
"imports": Array [
1356+
Object {
1357+
"importName": "___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___",
1358+
"url": "\\"../../../../src/runtime/noSourceMaps.js\\"",
1359+
},
1360+
Object {
1361+
"importName": "___CSS_LOADER_API_IMPORT___",
1362+
"type": "api_import",
1363+
"url": "\\"../../../../src/runtime/api.js\\"",
1364+
},
1365+
],
1366+
"replacements": Array [],
1367+
"resourcePath": "<ROOT_DIR>/test/fixtures/modules/getJSON/composeSourceB.css",
1368+
},
1369+
],
13471370
Array [
13481371
Object {
13491372
"exports": Array [
@@ -1406,30 +1429,7 @@ Array [
14061429
"replacementName": "___CSS_LOADER_ICSS_IMPORT_1_REPLACEMENT_1___",
14071430
},
14081431
],
1409-
"resourcePath": "/Users/skao/workspace/webpack-contrib/css-loader/test/fixtures/modules/getJSON/source.css",
1410-
},
1411-
],
1412-
Array [
1413-
Object {
1414-
"exports": Array [
1415-
Object {
1416-
"name": "composedB",
1417-
"value": "gFdUXtR3F_6oyBd_qgU8",
1418-
},
1419-
],
1420-
"imports": Array [
1421-
Object {
1422-
"importName": "___CSS_LOADER_API_NO_SOURCEMAP_IMPORT___",
1423-
"url": "\\"../../../../src/runtime/noSourceMaps.js\\"",
1424-
},
1425-
Object {
1426-
"importName": "___CSS_LOADER_API_IMPORT___",
1427-
"type": "api_import",
1428-
"url": "\\"../../../../src/runtime/api.js\\"",
1429-
},
1430-
],
1431-
"replacements": Array [],
1432-
"resourcePath": "/Users/skao/workspace/webpack-contrib/css-loader/test/fixtures/modules/getJSON/composeSourceB.css",
1432+
"resourcePath": "<ROOT_DIR>/test/fixtures/modules/getJSON/source.css",
14331433
},
14341434
],
14351435
Array [
@@ -1456,7 +1456,7 @@ Array [
14561456
},
14571457
],
14581458
"replacements": Array [],
1459-
"resourcePath": "/Users/skao/workspace/webpack-contrib/css-loader/test/fixtures/modules/getJSON/composeSourceC.css",
1459+
"resourcePath": "<ROOT_DIR>/test/fixtures/modules/getJSON/composeSourceC.css",
14601460
},
14611461
],
14621462
]

test/modules-option.test.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -2429,7 +2429,12 @@ describe('"modules" option', () => {
24292429
});
24302430
const stats = await compile(compiler);
24312431

2432-
const args = getJSONSpy.mock.calls;
2432+
const args = getJSONSpy.mock.calls.map((arg) => [
2433+
{
2434+
...arg[0],
2435+
resourcePath: arg[0].resourcePath.replace(process.cwd(), "<ROOT_DIR>"),
2436+
},
2437+
]);
24332438
expect(args).toMatchSnapshot("args");
24342439

24352440
expect(
@@ -2452,7 +2457,12 @@ describe('"modules" option', () => {
24522457
});
24532458
const stats = await compile(compiler);
24542459

2455-
const args = getJSONSpy.mock.calls;
2460+
const args = getJSONSpy.mock.calls.map((arg) => [
2461+
{
2462+
...arg[0],
2463+
resourcePath: arg[0].resourcePath.replace(process.cwd(), "<ROOT_DIR>"),
2464+
},
2465+
]);
24562466
expect(args).toMatchSnapshot("args");
24572467

24582468
expect(

0 commit comments

Comments
 (0)