Skip to content

Commit

Permalink
Merge pull request #7560 from webpack/bugfix/cache-run
Browse files Browse the repository at this point in the history
add test case for #7533
  • Loading branch information
sokra committed Jun 20, 2018
2 parents 6f90257 + 2fa0ea6 commit 7f937e8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/Compiler.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -448,4 +448,26 @@ describe("Compiler", () => {
});
});
});
it("should use cache on second run call", function(done) {
const compiler = webpack({
context: __dirname,
mode: "development",
devtool: false,
entry: "./fixtures/count-loader!./fixtures/count-loader",
output: {
path: "/"
}
});
compiler.outputFileSystem = new MemoryFs();
compiler.run(() => {
compiler.run(() => {
const result = compiler.outputFileSystem.readFileSync(
"/main.js",
"utf-8"
);
expect(result).toContain("module.exports = 0;");
done();
});
});
});
});
5 changes: 5 additions & 0 deletions test/fixtures/count-loader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
let counter = 0;

module.exports = function() {
return `module.exports = ${counter++};`;
};

0 comments on commit 7f937e8

Please sign in to comment.