forked from webpack/webpack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIntegration.test.js
More file actions
80 lines (78 loc) · 1.83 KB
/
Integration.test.js
File metadata and controls
80 lines (78 loc) · 1.83 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
var should = require("should");
var path = require("path");
var webpack = require("../lib/webpack");
describe("Integration", function() {
it("should compile library1", function(done) {
webpack({
entry: "library1",
context: path.join(__dirname, "browsertest"),
output: {
pathinfo: true,
path: path.join(__dirname, "browsertest", "js"),
filename: "library1.js",
library: "library1"
}
}, function(err, stats) {
if(err) throw err;
stats.hasErrors().should.be.not.ok;
stats.hasWarnings().should.be.not.ok;
done();
});
});
it("should compile library2", function(done) {
webpack({
entry: "library2",
context: path.join(__dirname, "browsertest"),
output: {
pathinfo: true,
path: path.join(__dirname, "browsertest", "js"),
filename: "library2.js",
publicPath: "js/",
library: "library2"
},
module: {
postLoaders: [
{
test: /extra2\.js/,
loader: "raw!extra!val?cacheable"
}
]
},
optimize: {
maxChunks: 2,
},
define: {
CONST_TRUE: true,
CONST_FALSE: false,
CONST_FUNCTION: function() { return "ok"; },
CONST_NUMBER: 123,
CONST_NUMBER_EXPR: "1*100+23",
CONST_OBJECT: {
A: 1,
B: JSON.stringify("B"),
C: function() { return "C"; }
}
},
amd: {
fromOptions: true
},
resolve: {
// cannot resolve should outside the outermost node_modules
// so it is injected here
alias: { should: require.resolve("should") }
},
plugins: {
"after-environment": function() {
this.resolver.plugin("module-resolved", function(request, callback) {
callback(null, request.replace(/extra\.js/, "extra2.js"));
});
}
}
}, function(err, stats) {
if(err) throw err;
stats.hasErrors().should.be.not.ok;
stats.hasWarnings().should.be.not.ok;
done();
});
});
});