Skip to content

Commit cb60b15

Browse files
hemal7735evenstensberg
authored andcommitted
tests(output): use extractSummary
1 parent 7bde073 commit cb60b15

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed
Lines changed: 8 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("output-argument", () => {
66
const { code, stdout } = run(__dirname, [
@@ -10,9 +10,12 @@ test("output-argument", () => {
1010
"--target",
1111
"async-node"
1212
]);
13+
14+
const summary = extractSummary(stdout);
15+
1316
expect(code).toBe(0);
14-
expect(stdout).toEqual(expect.anything());
15-
expect(stdout).toContain("bundle.js");
16-
expect(stdout).toMatch(/index\.js.*\{0\}/);
17-
expect(stdout).toMatchSnapshot();
17+
expect(summary).toEqual(expect.anything());
18+
expect(summary).toContain("bundle.js");
19+
expect(summary).toMatch(/index\.js.*\{0\}/);
20+
expect(summary).toMatchSnapshot();
1821
});

test/binCases/output/output-library-many/output-library-many.test.js

Lines changed: 6 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
const { readFileSync } = require("fs");
66
const { resolve } = require("path");
@@ -18,12 +18,14 @@ test("output-library-many", () => {
1818
"key2"
1919
]);
2020

21+
const summary = extractSummary(stdout);
22+
2123
expect(code).toBe(0);
22-
expect(stdout).toEqual(expect.anything());
23-
expect(stdout).toMatch(/index\.js.*\{0\}/);
24+
expect(summary).toEqual(expect.anything());
25+
expect(summary).toMatch(/index\.js.*\{0\}/);
2426
expect(stderr).toHaveLength(0);
2527
const outputPath = resolve(__dirname, "bin/main.js");
2628
const output = readFileSync(outputPath, "utf-8");
2729
expect(output).toContain("window.key1=window.key1||{},window.key1.key2=function");
28-
expect(stdout).toMatchSnapshot();
30+
expect(summary).toMatchSnapshot();
2931
});

test/binCases/output/output-library-single/output-library-single.test.js

Lines changed: 6 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
const { readFileSync } = require("fs");
66
const { resolve } = require("path");
@@ -16,12 +16,14 @@ test("output-library-single", () => {
1616
"key1"
1717
]);
1818

19+
const summary = extractSummary(stdout);
20+
1921
expect(code).toBe(0);
20-
expect(stdout).toEqual(expect.anything());
21-
expect(stdout).toMatch(/index\.js.*\{0\}/);
22+
expect(summary).toEqual(expect.anything());
23+
expect(summary).toMatch(/index\.js.*\{0\}/);
2224
expect(stderr).toHaveLength(0);
2325
const outputPath = resolve(__dirname, "bin", "main.js");
2426
const output = readFileSync(outputPath, "utf-8");
2527
expect(output).toContain("window.key1=function");
26-
expect(stdout).toMatchSnapshot();
28+
expect(summary).toMatchSnapshot();
2729
});

0 commit comments

Comments
 (0)