Skip to content

Commit 26b5582

Browse files
test: more
1 parent 05b066c commit 26b5582

4 files changed

Lines changed: 54 additions & 5 deletions

File tree

packages/webpack-cli/src/webpack-cli.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,7 @@ class WebpackCLI {
322322
return typeof value === "function";
323323
}
324324

325-
capitalizeFirstLetter(str: string | unknown): string {
326-
if (typeof str !== "string") {
327-
return "";
328-
}
329-
325+
capitalizeFirstLetter(str: string): string {
330326
return str.charAt(0).toUpperCase() + str.slice(1);
331327
}
332328

test/build/progress/progress-flag.test.js

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,32 @@ describe("progress flag", () => {
4444
expect(stdout).toContain("main.js");
4545
expect(stdout.match(/ProgressPlugin/g)).toHaveLength(1);
4646
});
47+
48+
it("should work with multiple compilers #2", async () => {
49+
const { exitCode, stderr, stdout } = await run(__dirname, [
50+
"-c",
51+
"webpack.multiple.config.js",
52+
"--progress",
53+
]);
54+
55+
expect(exitCode).toBe(0);
56+
expect(stderr).not.toMatch(/\[webpack\.Progress] \d+ ms setup/);
57+
expect(stderr).toContain("[webpack.Progress] 100% [first]");
58+
expect(stderr).toContain("[webpack.Progress] 100% [second]");
59+
expect(stdout).toContain("main.js");
60+
});
61+
62+
it("should work with multiple compilers #2", async () => {
63+
const { exitCode, stderr, stdout } = await run(__dirname, [
64+
"-c",
65+
"webpack.progress.multiple.config.js",
66+
"--progress",
67+
]);
68+
69+
expect(exitCode).toBe(0);
70+
expect(stderr).not.toMatch(/\[webpack\.Progress] \d+ ms setup/);
71+
expect(stderr).toContain("[webpack.Progress] 100% [second]");
72+
expect(stdout).toContain("main.js");
73+
expect(stdout.match(/ProgressPlugin/g)).toHaveLength(1);
74+
});
4775
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin");
2+
3+
module.exports = [
4+
{
5+
name: "first",
6+
plugins: [new WebpackCLITestPlugin()],
7+
},
8+
{
9+
name: "second",
10+
plugins: [new WebpackCLITestPlugin()],
11+
},
12+
];
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const { ProgressPlugin } = require("webpack");
2+
const WebpackCLITestPlugin = require("../../utils/webpack-cli-test-plugin");
3+
4+
module.exports = [
5+
{
6+
name: "first",
7+
plugins: [new ProgressPlugin(), new WebpackCLITestPlugin()],
8+
},
9+
{
10+
name: "second",
11+
plugins: [new WebpackCLITestPlugin()],
12+
},
13+
];

0 commit comments

Comments
 (0)