Skip to content

Commit b9c1f9b

Browse files
committed
add test for webpack#4260
1 parent 2fdd833 commit b9c1f9b

5 files changed

Lines changed: 31 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// We test that the CLI define for TEST will override the one defined in
2+
// webpack.config.js. If the presedence is correct the entry will require ok.js,
3+
// if not it will try to require fail.js and fail.
4+
require("./" + TEST + ".js");
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = "ok";
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
"use strict";
2+
3+
module.exports = function testAssertions(code, stdout, stderr) {
4+
code.should.be.exactly(0);
5+
6+
stdout.should.be.ok();
7+
stdout[6].should.containEql('ok.js')
8+
stderr.should.be.empty();
9+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
--entry ./index.js
2+
--config ./webpack.config.js
3+
--output-filename [name].js
4+
--output-chunk-filename [id].chunk.js
5+
--target async-node
6+
--define TEST="ok"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var DefinePlugin = require("../../../../lib/DefinePlugin");
2+
var path = require("path");
3+
4+
module.exports = {
5+
entry: path.resolve(__dirname, "./index"),
6+
plugins: [
7+
new DefinePlugin({
8+
TEST: JSON.stringify("fail")
9+
})
10+
]
11+
};

0 commit comments

Comments
 (0)