-
-
Notifications
You must be signed in to change notification settings - Fork 591
/
functional-config.test.js
33 lines (28 loc) · 1.12 KB
/
functional-config.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use strict";
const { resolve } = require("path");
const { existsSync } = require("fs");
const { run } = require("../../../utils/test-utils");
describe("functional config", () => {
it("should build and not throw error with single configuration", async () => {
const { stderr, stdout, exitCode } = await run(__dirname, [
"--config",
resolve(__dirname, "single-webpack.config.js"),
]);
expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toContain("./src/index.js");
expect(existsSync(resolve(__dirname, "./dist/dist-single.js"))).toBeTruthy();
});
it("should build and not throw errors with multiple configurations", async () => {
const { exitCode, stderr, stdout } = await run(__dirname, [
"--config",
resolve(__dirname, "multi-webpack.config.js"),
]);
expect(exitCode).toBe(0);
expect(stderr).toBeFalsy();
expect(stdout).toContain("first");
expect(stdout).toContain("second");
expect(existsSync(resolve(__dirname, "./dist/dist-first.js"))).toBeTruthy();
expect(existsSync(resolve(__dirname, "./dist/dist-second.js"))).toBeTruthy();
});
});