-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
/
index.js
44 lines (41 loc) · 1.14 KB
/
index.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
34
35
36
37
38
39
40
41
42
43
44
require("should");
import * as both from './dynamic-and-static'
import * as staticModule from './static'
it("should not change chunkhash of manifest chunk", function () {
const manifestChunk = STATS_JSON.chunks.find((chunk) => chunk.names.indexOf("manifest") !== -1);
(!manifestChunk).should.be.false("Main chunk not found");
switch (WATCH_STEP) {
case "0":
STATE.hash = manifestChunk.hash;
staticModule.should.be.eql("Normal");
both.should.be.eql("Normal");
break;
case "1":
manifestChunk.hash.should.be.eql(STATE.hash);
staticModule.should.be.eql("Changed");
both.should.be.eql("Normal");
break;
case "2":
manifestChunk.hash.should.be.eql(STATE.hash);
staticModule.should.be.eql("Changed");
both.should.be.eql("Changed");
break;
}
});
it("should load additional chunk", function (done) {
const step = WATCH_STEP;
import(/* webpackChunkName: "dynamic-and-static" */ './dynamic-and-static')
.then((dynamic) => {
switch (step) {
case "0":
case "1":
dynamic.should.be.eql("Normal");
break;
case "2":
dynamic.should.be.eql("Changed");
break;
}
done();
})
.catch(done);;
});