-
-
Notifications
You must be signed in to change notification settings - Fork 591
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests(config): add config-location tests (#689)
- Loading branch information
1 parent
14ec0a5
commit 7ec1855
Showing
12 changed files
with
119 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "find-recursively"; |
9 changes: 9 additions & 0 deletions
9
...config-location/find-recursively/packages/foo/__snapshots__/find-recursively.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`find-recursively 1`] = ` | ||
"Child | ||
Asset Size Chunks Chunk Names | ||
main.js 958 bytes 0 [emitted] main | ||
Entrypoint main = main.js | ||
[0] /Users/tamaslakatos/playground/webpack-cli/test/binCases/config-location/find-recursively/index2.js 37 bytes {0} [built]" | ||
`; |
21 changes: 21 additions & 0 deletions
21
test/binCases/config-location/find-recursively/packages/foo/find-recursively.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"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); | ||
expect(stdout).toMatchSnapshot(); | ||
}); |
7 changes: 7 additions & 0 deletions
7
test/binCases/config-location/find-recursively/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
var path = require("path"); | ||
|
||
module.exports = [ | ||
{ | ||
entry: path.resolve(__dirname, "./index2") | ||
}, | ||
]; |
8 changes: 8 additions & 0 deletions
8
test/binCases/config-location/set-explicitly/__snapshots__/set-explicitly.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`set-explicitly 1`] = ` | ||
" Asset Size Chunks Chunk Names | ||
main.js 956 bytes 0 [emitted] main | ||
Entrypoint main = main.js | ||
[0] ./index.js 35 bytes {0} [built]" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "set-explicitly"; |
25 changes: 25 additions & 0 deletions
25
test/binCases/config-location/set-explicitly/set-explicitly.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"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); | ||
expect(stdout).toMatchSnapshot(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var path = require("path"); | ||
|
||
module.exports = [ | ||
{ | ||
name: "foo", | ||
entry: path.resolve(__dirname, "./index") | ||
}, | ||
]; |
9 changes: 9 additions & 0 deletions
9
test/binCases/config-location/set-implicitly/__snapshots__/set-implicitly.test.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`set-implicitly 1`] = ` | ||
"Child foo: | ||
Asset Size Chunks Chunk Names | ||
main.js 956 bytes 0 [emitted] main | ||
Entrypoint main = main.js | ||
[0] ./index2.js 35 bytes {0} [built]" | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = "set-implicitly"; |
21 changes: 21 additions & 0 deletions
21
test/binCases/config-location/set-implicitly/set-implicitly.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
"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); | ||
expect(stdout).toMatchSnapshot(); | ||
}); |
8 changes: 8 additions & 0 deletions
8
test/binCases/config-location/set-implicitly/webpack.config.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
var path = require("path"); | ||
|
||
module.exports = [ | ||
{ | ||
name: "foo", | ||
entry: path.resolve(__dirname, "./index2") | ||
}, | ||
]; |