Skip to content

Commit dbb3e29

Browse files
committed
fix: add test for empty path
1 parent fd8e0aa commit dbb3e29

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

test/__snapshots__/validate-plugin-options.test.js.snap

+10
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ exports[`validate options should throw an error on the "attributes" option with
88
-> Read more at https://github.com/webpack-contrib/mini-css-extract-plugin#attributes"
99
`;
1010

11+
exports[`validate options should throw an error on the "chunkFilename" option with "" value 1`] = `
12+
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
13+
- options.chunkFilename should be a non-empty string."
14+
`;
15+
1116
exports[`validate options should throw an error on the "chunkFilename" option with "/styles/[id].css" value 1`] = `
1217
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
1318
- options.chunkFilename: A relative path is expected. However, the provided value \\"/styles/[id].css\\" is an absolute path!"
@@ -24,6 +29,11 @@ exports[`validate options should throw an error on the "chunkFilename" option wi
2429
* options.chunkFilename should be an instance of function."
2530
`;
2631

32+
exports[`validate options should throw an error on the "filename" option with "" value 1`] = `
33+
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
34+
- options.filename should be a non-empty string."
35+
`;
36+
2737
exports[`validate options should throw an error on the "filename" option with "/styles/[name].css" value 1`] = `
2838
"Invalid options object. Mini CSS Extract Plugin has been initialized using an options object that does not match the API schema.
2939
- options.filename: A relative path is expected. However, the provided value \\"/styles/[name].css\\" is an absolute path!"

test/validate-plugin-options.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ describe("validate options", () => {
77
"[name].css",
88
({ name }) => `${name.replace("/js/", "/css/")}.css`,
99
],
10-
failure: [true, "/styles/[name].css"],
10+
failure: [true, "/styles/[name].css", ""],
1111
},
1212
chunkFilename: {
1313
success: ["[id].css", ({ chunk }) => `${chunk.id}.${chunk.name}.css`],
14-
failure: [true, "/styles/[id].css"],
14+
failure: [true, "/styles/[id].css", ""],
1515
},
1616
ignoreOrder: {
1717
success: [true, false],

0 commit comments

Comments
 (0)