Skip to content

Commit 460e6b6

Browse files
committed
remove incorrect tests
1 parent 0975d13 commit 460e6b6

File tree

2 files changed

+0
-263
lines changed

2 files changed

+0
-263
lines changed

test/CachePlugin.test.js

Lines changed: 0 additions & 238 deletions
Original file line numberDiff line numberDiff line change
@@ -43,242 +43,4 @@ describe("CachePlugin", () => {
4343
env.plugin.FS_ACCURENCY.should.be.exactly(1000);
4444
});
4545
});
46-
47-
describe("when applied", () => {
48-
describe("for multiple compilers", () => {
49-
beforeEach(() => {
50-
const plugin = new CachePlugin();
51-
env.compilers = [sinon.spy(), sinon.spy()];
52-
plugin.apply({
53-
compilers: env.compilers
54-
});
55-
});
56-
57-
it("calls each compilers apply with the cache plugin context", () => {
58-
env.compilers[0].callCount.should.be.exactly(1);
59-
env.compilers[0].firstCall.thisValue.should.be.instanceOf(CachePlugin);
60-
env.compilers[1].callCount.should.be.exactly(1);
61-
env.compilers[1].firstCall.thisValue.should.be.instanceOf(CachePlugin);
62-
});
63-
});
64-
65-
describe("for a single compiler", () => {
66-
beforeEach(() => {
67-
const applyContext = {};
68-
env.eventBindings = applyPluginWithOptions.call(applyContext, CachePlugin, {
69-
test: true
70-
});
71-
env.plugin = applyContext.plugin;
72-
});
73-
74-
it("binds four event handlers", () =>
75-
env.eventBindings.length.should.be.exactly(4));
76-
77-
it("sets the initial cache", () =>
78-
env.plugin.cache.test.should.be.true());
79-
80-
describe("compilation handler", () => {
81-
it("binds to compilation event", () =>
82-
env.eventBindings[0].name.should.be.exactly("compilation"));
83-
84-
describe("when cachable", () => {
85-
describe("and not watching", () => {
86-
beforeEach(() =>
87-
env.eventBindings[0].handler(env.compilation));
88-
89-
it("sets the compilation cache", () =>
90-
env.compilation.cache.should.deepEqual({
91-
test: true
92-
}));
93-
});
94-
95-
describe("and watching", () => {
96-
beforeEach(() => {
97-
env.eventBindings[1].handler(env.compilation, () => {});
98-
env.eventBindings[0].handler(env.compilation);
99-
});
100-
101-
it("does not add a compilation warning is added", () =>
102-
env.compilation.warnings.should.be.empty());
103-
});
104-
});
105-
106-
describe("when not cachable", () => {
107-
beforeEach(() =>
108-
env.compilation.notCacheable = true);
109-
110-
describe("and not watching", () => {
111-
beforeEach(() =>
112-
env.eventBindings[0].handler(env.compilation));
113-
114-
it("does not set the cache", () =>
115-
should(env.compilation.cache).be.undefined());
116-
});
117-
118-
describe("and watching", () => {
119-
beforeEach(() => {
120-
env.eventBindings[1].handler(env.compilation, () => {});
121-
env.eventBindings[0].handler(env.compilation);
122-
});
123-
124-
it("adds a compilation warning", () => {
125-
env.compilation.warnings.length.should.be.exactly(1);
126-
env.compilation.warnings[0].should.be.Error("CachePlugin - Cache cannot be used because of: true");
127-
});
128-
});
129-
});
130-
});
131-
132-
describe("watch-run handler", () => {
133-
beforeEach(() => {
134-
env.callback = sinon.spy();
135-
env.eventBindings[1].handler(env.compilation.compiler, env.callback);
136-
});
137-
138-
it("binds to watch-run event", () =>
139-
env.eventBindings[1].name.should.be.exactly("watch-run"));
140-
141-
it("sets watching flag", () =>
142-
env.plugin.watching.should.be.true());
143-
144-
it("calls callback", () =>
145-
env.callback.callCount.should.be.exactly(1));
146-
});
147-
148-
describe("run handler", () => {
149-
beforeEach(() => {
150-
env.fsStat = sinon.spy();
151-
env.callback = sinon.spy();
152-
env.compilation.compiler.inputFileSystem = {
153-
stat: env.fsStat
154-
};
155-
});
156-
157-
it("binds to run event", () =>
158-
env.eventBindings[2].name.should.be.exactly("run"));
159-
160-
describe("Has not previously compiled", () => {
161-
beforeEach(() =>
162-
env.eventBindings[2].handler(env.compilation.compiler, env.callback));
163-
164-
it("does not get any file stats", () =>
165-
env.fsStat.callCount.should.be.exactly(0));
166-
167-
it("calls the callback", () => {
168-
env.callback.callCount.should.be.exactly(1);
169-
should(env.callback.firstCall.args[0]).be.undefined();
170-
});
171-
});
172-
173-
describe("Has previously compiled", () => {
174-
beforeEach(() => {
175-
env.compilation.fileDependencies = ["foo"];
176-
env.compilation.contextDependencies = ["bar"];
177-
env.eventBindings[3].handler(env.compilation, () => {});
178-
env.eventBindings[2].handler(env.compilation.compiler, env.callback);
179-
});
180-
181-
it("calls for file stats for file dependencies", () => {
182-
env.fsStat.callCount.should.be.exactly(1);
183-
env.fsStat.firstCall.args[0].should.be.exactly("foo");
184-
});
185-
186-
describe("file stats callback", () => {
187-
beforeEach(() =>
188-
env.fsStatCallback = env.fsStat.firstCall.args[1]);
189-
190-
describe("when error occurs", () => {
191-
beforeEach(() =>
192-
env.fsStatCallback(new Error("Test Error")));
193-
194-
it("calls handler callback with error", () => {
195-
env.callback.callCount.should.be.exactly(1);
196-
env.callback.firstCall.args[0].should.be.Error("Test Error");
197-
});
198-
});
199-
200-
describe("when ENOENT error occurs", () => {
201-
beforeEach(() =>
202-
env.fsStatCallback({
203-
code: "ENOENT"
204-
}));
205-
206-
it("calls handler callback without error", () => {
207-
env.callback.callCount.should.be.exactly(1);
208-
should(env.callback.firstCall.args[0]).be.undefined();
209-
});
210-
});
211-
212-
describe("when stat does not have modified time", () => {
213-
beforeEach(() => {
214-
sinon.stub(env.plugin, "applyMtime");
215-
env.fsStatCallback(null, {});
216-
});
217-
218-
afterEach(() => env.plugin.applyMtime.restore());
219-
220-
it("does not update file system accuracy", () =>
221-
env.plugin.applyMtime.callCount.should.be.exactly(0));
222-
223-
it("updates file modified timestamp to infinity", () =>
224-
env.compilation.compiler.fileTimestamps.should.deepEqual({
225-
foo: Infinity
226-
}));
227-
228-
it("calls handler callback without error", () => {
229-
env.callback.callCount.should.be.exactly(1);
230-
should(env.callback.firstCall.args[0]).be.undefined();
231-
});
232-
});
233-
234-
describe("when stat has modified time", () => {
235-
beforeEach(() => {
236-
sinon.stub(env.plugin, "applyMtime");
237-
env.fsStatCallback(null, {
238-
mtime: 1483819067001
239-
});
240-
});
241-
242-
afterEach(() => env.plugin.applyMtime.restore());
243-
244-
it("does not update file system accuracy", () =>
245-
env.plugin.applyMtime.callCount.should.be.exactly(1));
246-
247-
it("updates file modified timestamp to modified time with accuracy value", () =>
248-
env.compilation.compiler.fileTimestamps.should.deepEqual({
249-
foo: 1483819069001
250-
}));
251-
252-
it("calls handler callback without error", () => {
253-
env.callback.callCount.should.be.exactly(1);
254-
should(env.callback.firstCall.args[0]).be.undefined();
255-
});
256-
});
257-
});
258-
});
259-
});
260-
261-
describe("after-compile handler", () => {
262-
beforeEach(() => {
263-
env.compilation.fileDependencies = ["foo"];
264-
env.compilation.contextDependencies = ["bar"];
265-
env.callback = sinon.spy();
266-
env.eventBindings[3].handler(env.compilation, env.callback);
267-
});
268-
269-
it("binds to after-compile event", () =>
270-
env.eventBindings[3].name.should.be.exactly("after-compile"));
271-
272-
it("saves copy of compilation file dependecies", () => {
273-
env.compilation.compiler.should.deepEqual({
274-
_lastCompilationFileDependencies: ["foo"],
275-
_lastCompilationContextDependencies: ["bar"]
276-
});
277-
});
278-
279-
it("calls callback", () =>
280-
env.callback.callCount.should.be.exactly(1));
281-
});
282-
});
283-
});
28446
});

test/Compiler.test.js

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -260,31 +260,6 @@ describe("Compiler", () => {
260260
done();
261261
});
262262
});
263-
describe("createChildCompiler", () => {
264-
it("defaults cache.children if none exists yet", (done) => {
265-
const mockPlugin = sinon.spy();
266-
class fakePlugin {
267-
apply() {
268-
mockPlugin();
269-
}
270-
}
271-
compiler.cache = {};
272-
compiler.createChildCompiler({}, "compiler9000", 0, {}, [new fakePlugin()]);
273-
mockPlugin.callCount.should.be.exactly(1);
274-
compiler.cache.children.should.match({});
275-
done();
276-
});
277-
it("defaults cache.children[compilerName] if none exists yet", (done) => {
278-
compiler.cache = {
279-
children: {},
280-
};
281-
compiler.createChildCompiler({}, "compiler9000", 0, {}, null);
282-
compiler.cache.children.should.match({
283-
compiler9000: [],
284-
});
285-
done();
286-
});
287-
});
288263
});
289264
describe("Watching", () => {
290265
let compiler;

0 commit comments

Comments
 (0)