Skip to content

Commit 1df1c04

Browse files
test: update
1 parent 4e9fb50 commit 1df1c04

File tree

4 files changed

+519
-532
lines changed

4 files changed

+519
-532
lines changed

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

Lines changed: 306 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,57 @@ Array [
410410

411411
exports[`"import" option should work resolve order: local -> node_modules -> alias: warnings 1`] = `Array []`;
412412

413+
exports[`"import" option should work when 'import.loaders' not specified: errors 1`] = `Array []`;
414+
415+
exports[`"import" option should work when 'import.loaders' not specified: module 1`] = `
416+
"// Imports
417+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
418+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js!./imported.css\\";
419+
import ___CSS_LOADER_AT_RULE_IMPORT_1___ from \\"-!../../../src/index.js!./other-imported.css\\";
420+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
421+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
422+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
423+
// Module
424+
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n color: rgba(0, 0, 255, 0.9);\\\\n}\\\\n\\", \\"\\"]);
425+
// Exports
426+
export default ___CSS_LOADER_EXPORT___;
427+
"
428+
`;
429+
430+
exports[`"import" option should work when 'import.loaders' not specified: result 1`] = `
431+
Array [
432+
Array [
433+
"../../src/index.js!./nested-import/imported.css",
434+
".bar {
435+
color: blue;
436+
color: rgb(0 0 100% / 90%);
437+
}
438+
",
439+
"",
440+
],
441+
Array [
442+
"../../src/index.js!./nested-import/other-imported.css",
443+
".baz {
444+
color: green;
445+
color: rgb(0 0 100% / 90%);
446+
}
447+
",
448+
"",
449+
],
450+
Array [
451+
"./nested-import/source.css",
452+
".foo {
453+
color: red;
454+
color: rgba(0, 0, 255, 0.9);
455+
}
456+
",
457+
"",
458+
],
459+
]
460+
`;
461+
462+
exports[`"import" option should work when 'import.loaders' not specified: warnings 1`] = `Array []`;
463+
413464
exports[`"import" option should work when not specified: errors 1`] = `Array []`;
414465

415466
exports[`"import" option should work when not specified: module 1`] = `
@@ -1347,6 +1398,261 @@ Array [
13471398

13481399
exports[`"import" option should work with 'false' aliases: warnings 1`] = `Array []`;
13491400

1401+
exports[`"import" option should work with a "import.loaders" value equal to ""1"" ("postcss-loader" before): errors 1`] = `Array []`;
1402+
1403+
exports[`"import" option should work with a "import.loaders" value equal to ""1"" ("postcss-loader" before): module 1`] = `
1404+
"// Imports
1405+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
1406+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./imported.css\\";
1407+
import ___CSS_LOADER_AT_RULE_IMPORT_1___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./other-imported.css\\";
1408+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
1409+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
1410+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
1411+
// Module
1412+
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n color: rgba(0, 0, 255, 0.9);\\\\n}\\\\n\\", \\"\\"]);
1413+
// Exports
1414+
export default ___CSS_LOADER_EXPORT___;
1415+
"
1416+
`;
1417+
1418+
exports[`"import" option should work with a "import.loaders" value equal to ""1"" ("postcss-loader" before): result 1`] = `
1419+
Array [
1420+
Array [
1421+
"../../src/index.js??ruleSet[1].rules[0].use[0]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./nested-import/imported.css",
1422+
".bar {
1423+
color: blue;
1424+
color: rgba(0, 0, 255, 0.9);
1425+
}
1426+
",
1427+
"",
1428+
],
1429+
Array [
1430+
"../../src/index.js??ruleSet[1].rules[0].use[0]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./nested-import/other-imported.css",
1431+
".baz {
1432+
color: green;
1433+
color: rgba(0, 0, 255, 0.9);
1434+
}
1435+
",
1436+
"",
1437+
],
1438+
Array [
1439+
"./nested-import/source.css",
1440+
".foo {
1441+
color: red;
1442+
color: rgba(0, 0, 255, 0.9);
1443+
}
1444+
",
1445+
"",
1446+
],
1447+
]
1448+
`;
1449+
1450+
exports[`"import" option should work with a "import.loaders" value equal to ""1"" ("postcss-loader" before): warnings 1`] = `Array []`;
1451+
1452+
exports[`"import" option should work with a "import.loaders" value equal to "0" (\`postcss-loader\` before): errors 1`] = `Array []`;
1453+
1454+
exports[`"import" option should work with a "import.loaders" value equal to "0" (\`postcss-loader\` before): module 1`] = `
1455+
"// Imports
1456+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
1457+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
1458+
import ___CSS_LOADER_AT_RULE_IMPORT_1___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./other-imported.css\\";
1459+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
1460+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
1461+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
1462+
// Module
1463+
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n color: rgba(0, 0, 255, 0.9);\\\\n}\\\\n\\", \\"\\"]);
1464+
// Exports
1465+
export default ___CSS_LOADER_EXPORT___;
1466+
"
1467+
`;
1468+
1469+
exports[`"import" option should work with a "import.loaders" value equal to "0" (\`postcss-loader\` before): result 1`] = `
1470+
Array [
1471+
Array [
1472+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./nested-import/imported.css",
1473+
".bar {
1474+
color: blue;
1475+
color: rgb(0 0 100% / 90%);
1476+
}
1477+
",
1478+
"",
1479+
],
1480+
Array [
1481+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./nested-import/other-imported.css",
1482+
".baz {
1483+
color: green;
1484+
color: rgb(0 0 100% / 90%);
1485+
}
1486+
",
1487+
"",
1488+
],
1489+
Array [
1490+
"./nested-import/source.css",
1491+
".foo {
1492+
color: red;
1493+
color: rgba(0, 0, 255, 0.9);
1494+
}
1495+
",
1496+
"",
1497+
],
1498+
]
1499+
`;
1500+
1501+
exports[`"import" option should work with a "import.loaders" value equal to "0" (\`postcss-loader\` before): warnings 1`] = `Array []`;
1502+
1503+
exports[`"import" option should work with a "import.loaders" value equal to "1" ("postcss-loader" before): errors 1`] = `Array []`;
1504+
1505+
exports[`"import" option should work with a "import.loaders" value equal to "1" ("postcss-loader" before): module 1`] = `
1506+
"// Imports
1507+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
1508+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./imported.css\\";
1509+
import ___CSS_LOADER_AT_RULE_IMPORT_1___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./other-imported.css\\";
1510+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
1511+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
1512+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
1513+
// Module
1514+
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n color: rgba(0, 0, 255, 0.9);\\\\n}\\\\n\\", \\"\\"]);
1515+
// Exports
1516+
export default ___CSS_LOADER_EXPORT___;
1517+
"
1518+
`;
1519+
1520+
exports[`"import" option should work with a "import.loaders" value equal to "1" ("postcss-loader" before): result 1`] = `
1521+
Array [
1522+
Array [
1523+
"../../src/index.js??ruleSet[1].rules[0].use[0]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./nested-import/imported.css",
1524+
".bar {
1525+
color: blue;
1526+
color: rgba(0, 0, 255, 0.9);
1527+
}
1528+
",
1529+
"",
1530+
],
1531+
Array [
1532+
"../../src/index.js??ruleSet[1].rules[0].use[0]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./nested-import/other-imported.css",
1533+
".baz {
1534+
color: green;
1535+
color: rgba(0, 0, 255, 0.9);
1536+
}
1537+
",
1538+
"",
1539+
],
1540+
Array [
1541+
"./nested-import/source.css",
1542+
".foo {
1543+
color: red;
1544+
color: rgba(0, 0, 255, 0.9);
1545+
}
1546+
",
1547+
"",
1548+
],
1549+
]
1550+
`;
1551+
1552+
exports[`"import" option should work with a "import.loaders" value equal to "1" ("postcss-loader" before): warnings 1`] = `Array []`;
1553+
1554+
exports[`"import" option should work with a "import.loaders" value equal to "1" (no loaders before): errors 1`] = `Array []`;
1555+
1556+
exports[`"import" option should work with a "import.loaders" value equal to "1" (no loaders before): module 1`] = `
1557+
"// Imports
1558+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
1559+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./imported.css\\";
1560+
import ___CSS_LOADER_AT_RULE_IMPORT_1___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!./other-imported.css\\";
1561+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
1562+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
1563+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
1564+
// Module
1565+
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n color: rgb(0 0 100% / 90%);\\\\n}\\\\n\\", \\"\\"]);
1566+
// Exports
1567+
export default ___CSS_LOADER_EXPORT___;
1568+
"
1569+
`;
1570+
1571+
exports[`"import" option should work with a "import.loaders" value equal to "1" (no loaders before): result 1`] = `
1572+
Array [
1573+
Array [
1574+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./nested-import/imported.css",
1575+
".bar {
1576+
color: blue;
1577+
color: rgb(0 0 100% / 90%);
1578+
}
1579+
",
1580+
"",
1581+
],
1582+
Array [
1583+
"../../src/index.js??ruleSet[1].rules[0].use[0]!./nested-import/other-imported.css",
1584+
".baz {
1585+
color: green;
1586+
color: rgb(0 0 100% / 90%);
1587+
}
1588+
",
1589+
"",
1590+
],
1591+
Array [
1592+
"./nested-import/source.css",
1593+
".foo {
1594+
color: red;
1595+
color: rgb(0 0 100% / 90%);
1596+
}
1597+
",
1598+
"",
1599+
],
1600+
]
1601+
`;
1602+
1603+
exports[`"import" option should work with a "import.loaders" value equal to "1" (no loaders before): warnings 1`] = `Array []`;
1604+
1605+
exports[`"import" option should work with a "import.loaders" value equal to "2" ("postcss-loader" before): errors 1`] = `Array []`;
1606+
1607+
exports[`"import" option should work with a "import.loaders" value equal to "2" ("postcss-loader" before): module 1`] = `
1608+
"// Imports
1609+
import ___CSS_LOADER_API_IMPORT___ from \\"../../../src/runtime/api.js\\";
1610+
import ___CSS_LOADER_AT_RULE_IMPORT_0___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./imported.css\\";
1611+
import ___CSS_LOADER_AT_RULE_IMPORT_1___ from \\"-!../../../src/index.js??ruleSet[1].rules[0].use[0]!../../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./other-imported.css\\";
1612+
var ___CSS_LOADER_EXPORT___ = ___CSS_LOADER_API_IMPORT___(function(i){return i[1]});
1613+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_0___);
1614+
___CSS_LOADER_EXPORT___.i(___CSS_LOADER_AT_RULE_IMPORT_1___);
1615+
// Module
1616+
___CSS_LOADER_EXPORT___.push([module.id, \\".foo {\\\\n color: red;\\\\n color: rgba(0, 0, 255, 0.9);\\\\n}\\\\n\\", \\"\\"]);
1617+
// Exports
1618+
export default ___CSS_LOADER_EXPORT___;
1619+
"
1620+
`;
1621+
1622+
exports[`"import" option should work with a "import.loaders" value equal to "2" ("postcss-loader" before): result 1`] = `
1623+
Array [
1624+
Array [
1625+
"../../src/index.js??ruleSet[1].rules[0].use[0]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./nested-import/imported.css",
1626+
".bar {
1627+
color: blue;
1628+
color: rgba(0, 0, 255, 0.9);
1629+
}
1630+
",
1631+
"",
1632+
],
1633+
Array [
1634+
"../../src/index.js??ruleSet[1].rules[0].use[0]!../../node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[0].use[1]!./nested-import/other-imported.css",
1635+
".baz {
1636+
color: green;
1637+
color: rgba(0, 0, 255, 0.9);
1638+
}
1639+
",
1640+
"",
1641+
],
1642+
Array [
1643+
"./nested-import/source.css",
1644+
".foo {
1645+
color: red;
1646+
color: rgba(0, 0, 255, 0.9);
1647+
}
1648+
",
1649+
"",
1650+
],
1651+
]
1652+
`;
1653+
1654+
exports[`"import" option should work with a "import.loaders" value equal to "2" ("postcss-loader" before): warnings 1`] = `Array []`;
1655+
13501656
exports[`"import" option should work with a value equal to "false": errors 1`] = `Array []`;
13511657

13521658
exports[`"import" option should work with a value equal to "false": module 1`] = `

0 commit comments

Comments
 (0)