Skip to content

Commit

Permalink
tests(config-name): use extractSummary
Browse files Browse the repository at this point in the history
  • Loading branch information
hemal7735 authored and evenstensberg committed Feb 5, 2019
1 parent 73714f5 commit 3e30a57
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
12 changes: 7 additions & 5 deletions test/binCases/config-name/found-many/found-many.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("found-many", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -18,10 +18,12 @@ test("found-many", () => {
"production"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("./index2.js");
expect(stdout).toContain("./index3.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("./index2.js");
expect(summary).toContain("./index3.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});
11 changes: 7 additions & 4 deletions test/binCases/config-name/found-one/found-one.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("found-one", () => {
const { code, stdout, stderr } = run(__dirname, [
Expand All @@ -15,9 +15,12 @@ test("found-one", () => {
"--target",
"async-node"
]);

const summary = extractSummary(stdout);

expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("./index2.js");
expect(summary).toEqual(expect.anything());
expect(summary).toContain("./index2.js");
expect(stderr).toHaveLength(0);
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});
9 changes: 6 additions & 3 deletions test/binCases/config-name/not-found/not-found.test.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
"use strict";

const { run } = require("../../../testUtils");
const { run, extractSummary } = require("../../../testUtils");

test("not-found", () => {
const { code, stdout, stderr } = run(__dirname, ["--config", "./webpack.config.js", "--config-name", "foo"]);

const summary = extractSummary(stdout);

expect(code).not.toBe(0);
expect(stdout).toHaveLength(0);
expect(summary).toHaveLength(0);
expect(stderr).toContain("Configuration with name 'foo' was not found.");
expect(stdout).toMatchSnapshot();
expect(summary).toMatchSnapshot();
});

0 comments on commit 3e30a57

Please sign in to comment.