Skip to content

Commit

Permalink
tests(config): add config-location tests (#689)
Browse files Browse the repository at this point in the history
  • Loading branch information
lakatostamas committed Nov 18, 2018
1 parent 14ec0a5 commit e941b49
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 0 deletions.
1 change: 1 addition & 0 deletions test/binCases/config-location/find-recursively/index2.js
@@ -0,0 +1 @@
module.exports = "find-recursively";
@@ -0,0 +1,20 @@
"use strict";

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

test("find-recursively", () => {
const { code, stdout, stderr } = run(__dirname, [
"--output-filename",
"[name].js",
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"--mode",
"production"
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("/index2.js");
expect(stderr).toHaveLength(0);
});
@@ -0,0 +1,7 @@
var path = require("path");

module.exports = [
{
entry: path.resolve(__dirname, "./index2")
},
];
1 change: 1 addition & 0 deletions test/binCases/config-location/set-explicitly/index.js
@@ -0,0 +1 @@
module.exports = "set-explicitly";
@@ -0,0 +1,24 @@
"use strict";

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

test("set-explicitly", () => {
const { code, stdout, stderr } = run(__dirname, [
"--config",
"./webpack.dev.js",
"--config-name",
"foo",
"--output-filename",
"[name].js",
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"--mode",
"production",
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("./index.js");
expect(stderr).toHaveLength(0);
});
8 changes: 8 additions & 0 deletions test/binCases/config-location/set-explicitly/webpack.dev.js
@@ -0,0 +1,8 @@
var path = require("path");

module.exports = [
{
name: "foo",
entry: path.resolve(__dirname, "./index")
},
];
1 change: 1 addition & 0 deletions test/binCases/config-location/set-implicitly/index2.js
@@ -0,0 +1 @@
module.exports = "set-implicitly";
@@ -0,0 +1,20 @@
"use strict";

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

test("set-implicitly", () => {
const { code, stdout, stderr } = run(__dirname, [
"--output-filename",
"[name].js",
"--output-chunk-filename",
"[id].chunk.js",
"--target",
"async-node",
"--mode",
"production",
]);
expect(code).toBe(0);
expect(stdout).toEqual(expect.anything());
expect(stdout).toContain("./index2.js");
expect(stderr).toHaveLength(0);
});
@@ -0,0 +1,8 @@
var path = require("path");

module.exports = [
{
name: "foo",
entry: path.resolve(__dirname, "./index2")
},
];

0 comments on commit e941b49

Please sign in to comment.