Skip to content

Commit 3c8628c

Browse files
hemal7735evenstensberg
authored andcommitted
tests(errors): use extractSummary
1 parent aa0cf25 commit 3c8628c

3 files changed

Lines changed: 19 additions & 13 deletions

File tree

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
"use strict";
22

3-
const { run } = require("../../../testUtils");
3+
const { run, extractSummary } = require("../../../testUtils");
44

55
test("clean-webpack-options", () => {
66
const { code, stdout, stderr } = run(__dirname, []);
77

8+
const summary = extractSummary(stdout);
9+
810
expect(code).toBe(1);
911

10-
expect(stdout).toHaveLength(0);
12+
expect(summary).toHaveLength(0);
1113

1214
expect(stderr).toContain("Invalid configuration object.");
1315
expect(stderr).toContain("configuration.context should be a string");
1416
expect(stderr).toContain("The base directory ");
1517

1618
expect(stderr.split("\n")).toHaveLength(4);
17-
expect(stdout).toMatchSnapshot();
19+
expect(summary).toMatchSnapshot();
1820
expect(stderr).toMatchSnapshot();
1921
});
Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
"use strict";
22

3-
const { run } = require("../../../testUtils");
3+
const { run, extractSummary } = require("../../../testUtils");
44

55
test("info-verbosity", () => {
66
const { stderr, stdout, code } = run(__dirname, ["a", "bundle.js", "--mode", "production"]);
77

8+
const summary = extractSummary(stdout);
9+
810
expect(code).toBe(2);
9-
expect(stdout).toContain("bundle.js");
11+
expect(summary).toContain("bundle.js");
1012

1113
expect(stderr).toHaveLength(0);
1214
});
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
"use strict";
22

3-
const { run } = require("../../../testUtils");
3+
const { run, extractSummary } = require("../../../testUtils");
44

55
test("info-verbosity", () => {
66
const { stderr, stdout, code } = run(__dirname, []);
77

8+
const summary = extractSummary(stdout);
9+
810
expect(code).toBe(2);
9-
expect(stdout).toContain("./index.js");
10-
expect(stdout).toContain("[built]");
11-
expect(stdout).toContain("[failed]");
12-
expect(stdout).toContain("[1 error]");
13-
expect(stdout).toContain("ERROR in ./index.js");
14-
expect(stdout).toContain("Module parse failed:");
11+
expect(summary).toContain("./index.js");
12+
expect(summary).toContain("[built]");
13+
expect(summary).toContain("[failed]");
14+
expect(summary).toContain("[1 error]");
15+
expect(summary).toContain("ERROR in ./index.js");
16+
expect(summary).toContain("Module parse failed:");
1517

1618
expect(stderr).toHaveLength(0);
17-
expect(stdout).toMatchSnapshot();
19+
expect(summary).toMatchSnapshot();
1820
});

0 commit comments

Comments
 (0)