Skip to content

Commit 3e30a57

Browse files
hemal7735evenstensberg
authored andcommitted
tests(config-name): use extractSummary
1 parent 73714f5 commit 3e30a57

3 files changed

Lines changed: 20 additions & 12 deletions

File tree

test/binCases/config-name/found-many/found-many.test.js

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

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

55
test("found-many", () => {
66
const { code, stdout, stderr } = run(__dirname, [
@@ -18,10 +18,12 @@ test("found-many", () => {
1818
"production"
1919
]);
2020

21+
const summary = extractSummary(stdout);
22+
2123
expect(code).toBe(0);
22-
expect(stdout).toEqual(expect.anything());
23-
expect(stdout).toContain("./index2.js");
24-
expect(stdout).toContain("./index3.js");
24+
expect(summary).toEqual(expect.anything());
25+
expect(summary).toContain("./index2.js");
26+
expect(summary).toContain("./index3.js");
2527
expect(stderr).toHaveLength(0);
26-
expect(stdout).toMatchSnapshot();
28+
expect(summary).toMatchSnapshot();
2729
});

test/binCases/config-name/found-one/found-one.test.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

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

55
test("found-one", () => {
66
const { code, stdout, stderr } = run(__dirname, [
@@ -15,9 +15,12 @@ test("found-one", () => {
1515
"--target",
1616
"async-node"
1717
]);
18+
19+
const summary = extractSummary(stdout);
20+
1821
expect(code).toBe(0);
19-
expect(stdout).toEqual(expect.anything());
20-
expect(stdout).toContain("./index2.js");
22+
expect(summary).toEqual(expect.anything());
23+
expect(summary).toContain("./index2.js");
2124
expect(stderr).toHaveLength(0);
22-
expect(stdout).toMatchSnapshot();
25+
expect(summary).toMatchSnapshot();
2326
});
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
"use strict";
22

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

55
test("not-found", () => {
66
const { code, stdout, stderr } = run(__dirname, ["--config", "./webpack.config.js", "--config-name", "foo"]);
7+
8+
const summary = extractSummary(stdout);
9+
710
expect(code).not.toBe(0);
8-
expect(stdout).toHaveLength(0);
11+
expect(summary).toHaveLength(0);
912
expect(stderr).toContain("Configuration with name 'foo' was not found.");
10-
expect(stdout).toMatchSnapshot();
13+
expect(summary).toMatchSnapshot();
1114
});

0 commit comments

Comments
 (0)