Skip to content

Commit 58986e3

Browse files
committed
WIP14
1 parent 726d42e commit 58986e3

7 files changed

+4
-121
lines changed

lib/Chunk.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ class Chunk {
262262
queue.add(parent);
263263
}
264264
return true;
265-
}
265+
};
266266
if(this.isInitial() !== otherChunk.isInitial()) {
267267
if(this.isInitial()) {
268268
return isAvailable(this, otherChunk);

lib/RecordIdsPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class RecordIdsPlugin {
4444

4545
const getModuleIdentifier = module => {
4646
if(portableIds)
47-
return identifierUtils.makePathsRelative(compiler.context, module.identifier(), compilation.cache)
47+
return identifierUtils.makePathsRelative(compiler.context, module.identifier(), compilation.cache);
4848
return module.identifier();
4949
};
5050

lib/optimize/AutomaticCommonsChunksPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ module.exports = class AutomaticCommonsChunksPlugin {
109109
return test(module, chunks);
110110
if(typeof test === "boolean")
111111
return test;
112-
const names = chunks.map(c => c.name).concat(module.nameForCondition ? [module.nameForCondition()] : []).filter(Boolean)
112+
const names = chunks.map(c => c.name).concat(module.nameForCondition ? [module.nameForCondition()] : []).filter(Boolean);
113113
if(typeof test === "string") {
114114
for(const name of names)
115115
if(name.startsWith(test))

lib/web/JsonpMainTemplatePlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ class JsonpMainTemplatePlugin {
202202
"",
203203
"// run deferred modules when all chunks ready",
204204
"return checkDeferredModules();"
205-
]) : ""
205+
]) : ""
206206
]),
207207
"};",
208208
withDefer ? Template.asString([

test/Chunk.unittest.js

Lines changed: 0 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,6 @@ describe("Chunk", () => {
1414

1515
it("returns a string with modules information", () => should(ChunkInstance.toString()).be.exactly("Chunk[]"));
1616

17-
it("should have origins based in constructor information", () =>
18-
should(ChunkInstance.origins[0]).be.eql({
19-
module: "module-test",
20-
loc: "loc-test",
21-
name: "chunk-test"
22-
}));
23-
2417
it("should not be the initial instance", () => should(ChunkInstance.isInitial()).be.false());
2518

2619
describe("entry", () => {
@@ -63,29 +56,6 @@ describe("Chunk", () => {
6356
})).be.exactly(10));
6457
});
6558

66-
describe("checkConstraints", () => {
67-
it("throws an error", () =>
68-
should(() => {
69-
ChunkInstance.checkConstraints();
70-
}).not.throw(/checkConstraints/));
71-
});
72-
73-
describe("canBeIntegrated", () => {
74-
it("returns `false` if other object is initial", () => {
75-
const other = {
76-
isInitial: () => true
77-
};
78-
should(ChunkInstance.canBeIntegrated(other)).be.false();
79-
});
80-
81-
it("returns `true` if other object and chunk instance are NOT initial", () => {
82-
const other = {
83-
isInitial: () => false
84-
};
85-
should(ChunkInstance.canBeIntegrated(other)).be.true();
86-
});
87-
});
88-
8959
describe("removeModule", function() {
9060
let module;
9161
let removeChunkSpy;
@@ -111,56 +81,4 @@ describe("Chunk", () => {
11181
});
11282
});
11383
});
114-
115-
describe("removeChunk", function() {
116-
let chunk;
117-
let removeParentSpy;
118-
beforeEach(function() {
119-
removeParentSpy = sinon.spy();
120-
chunk = {
121-
removeParent: removeParentSpy
122-
};
123-
});
124-
describe("and the chunk does not contain this chunk", function() {
125-
it("returns false", function() {
126-
ChunkInstance.removeChunk(chunk).should.eql(false);
127-
});
128-
});
129-
describe("and the chunk does contain this module", function() {
130-
beforeEach(function() {
131-
ChunkInstance._chunks = new Set([chunk]);
132-
});
133-
it("calls module.removeChunk with itself and returns true", function() {
134-
ChunkInstance.removeChunk(chunk).should.eql(true);
135-
removeParentSpy.callCount.should.eql(1);
136-
removeParentSpy.args[0][0].should.eql(ChunkInstance);
137-
});
138-
});
139-
});
140-
141-
describe("removeParent", function() {
142-
let chunk;
143-
let removeChunkSpy;
144-
beforeEach(function() {
145-
removeChunkSpy = sinon.spy();
146-
chunk = {
147-
removeChunk: removeChunkSpy
148-
};
149-
});
150-
describe("and the chunk does not contain this chunk", function() {
151-
it("returns false", function() {
152-
ChunkInstance.removeParent(chunk).should.eql(false);
153-
});
154-
});
155-
describe("and the chunk does contain this module", function() {
156-
beforeEach(function() {
157-
ChunkInstance.setParents([chunk]);
158-
});
159-
it("calls module.removeChunk with itself and returns true", function() {
160-
ChunkInstance.removeParent(chunk).should.eql(true);
161-
removeChunkSpy.callCount.should.eql(1);
162-
removeChunkSpy.args[0][0].should.eql(ChunkInstance);
163-
});
164-
});
165-
});
16684
});

test/Errors.test.js

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -142,38 +142,6 @@ describe("Errors", () => {
142142
done();
143143
});
144144
});
145-
it("should throw an error when using incorrect CommonsChunkPlugin configuration", (done) => {
146-
getErrors({
147-
mode: "development",
148-
entry: {
149-
a: "./entry-point",
150-
b: "./entry-point",
151-
c: "./entry-point"
152-
},
153-
output: {
154-
filename: "[name].js"
155-
},
156-
plugins: [
157-
new webpack.optimize.CommonsChunkPlugin({
158-
name: "a",
159-
filename: "a.js",
160-
minChunks: Infinity
161-
}),
162-
new webpack.optimize.CommonsChunkPlugin({
163-
name: "b",
164-
filename: "b.js",
165-
minChunks: Infinity
166-
})
167-
]
168-
}, (errors, warnings) => {
169-
errors.length.should.be.eql(1);
170-
warnings.length.should.be.eql(0);
171-
const lines = errors[0].split("\n");
172-
lines[0].should.match(/CommonsChunkPlugin/);
173-
lines[0].should.match(/non-entry/);
174-
done();
175-
});
176-
});
177145
it("should throw an error when trying to use [chunkhash] when it's invalid", (done) => {
178146
getErrors({
179147
mode: "development",

test/browsertest/library2config.coffee

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ exports.default = new Promise (resolve, reject) ->
2020
plugins: [
2121
new webpack.optimize.LimitChunkCountPlugin
2222
maxChunks: 3
23-
new webpack.optimize.CommonsChunkPlugin
24-
name: "common"
25-
filename: "library2.commons.js"
2623
new webpack.DefinePlugin
2724
"typeof CONST_TYPEOF": JSON.stringify("typeof"),
2825
CONST_UNDEFINED: undefined,

0 commit comments

Comments
 (0)