Skip to content

Commit

Permalink
- Put Watching as a property on Compiler rather than a static method
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Truong authored and Kyle Truong committed Jul 7, 2017
1 parent 6dffcca commit 13bc80b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
11 changes: 5 additions & 6 deletions lib/Compiler.js
Expand Up @@ -161,7 +161,7 @@ class Watching {
}
}

module.exports = class Compiler extends Tapable {
class Compiler extends Tapable {
constructor() {
super();
this.outputPath = "";
Expand Down Expand Up @@ -214,10 +214,6 @@ module.exports = class Compiler extends Tapable {
this.options = {};
}

static Watching(compiler, watchOptions, handler) {
return new Watching(compiler, watchOptions, handler);
}

watch(watchOptions, handler) {
this.fileTimestamps = {};
this.contextTimestamps = {};
Expand Down Expand Up @@ -521,4 +517,7 @@ module.exports = class Compiler extends Tapable {
});
});
}
};
}

Compiler.Watching = Watching;
module.exports = Compiler;
16 changes: 8 additions & 8 deletions test/Compiler.test.js
Expand Up @@ -298,14 +298,14 @@ describe("Compiler", () => {
}
});
});
describe("static method", () => {
it("should have an accessible static method, Watching", (done) => {
const actual = Compiler.Watching(compiler, 1000, err => err);
actual.running.should.be.exactly(true);
actual.constructor.name.should.be.exactly("Watching");
done();
});
});
// describe("static method", () => {
// it("should have an accessible static method, Watching", (done) => {
// const actual = Compiler.Watching(compiler, 1000, err => err);
// actual.running.should.be.exactly(true);
// actual.constructor.name.should.be.exactly("Watching");
// done();
// });
// });
describe("constructor", () => {
it("constructs Watching.watchOptions correctly when passed a number, string, or object for watchOptions", (done) => {
const Watching1 = compiler.watch(1000, err => err);
Expand Down

0 comments on commit 13bc80b

Please sign in to comment.