Skip to content

Commit 0649671

Browse files
committed
add test case for webpack#7533
1 parent 02a955b commit 0649671

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

test/Compiler.test.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,4 +448,26 @@ describe("Compiler", () => {
448448
});
449449
});
450450
});
451+
it("should use cache on second run call", function(done) {
452+
const compiler = webpack({
453+
context: __dirname,
454+
mode: "development",
455+
devtool: false,
456+
entry: "./fixtures/count-loader!./fixtures/count-loader",
457+
output: {
458+
path: "/"
459+
}
460+
});
461+
compiler.outputFileSystem = new MemoryFs();
462+
compiler.run(() => {
463+
compiler.run(() => {
464+
const result = compiler.outputFileSystem.readFileSync(
465+
"/main.js",
466+
"utf-8"
467+
);
468+
expect(result).toContain("module.exports = 0;");
469+
done();
470+
});
471+
});
472+
})
451473
});

test/fixtures/count-loader.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
let counter = 0;
2+
3+
module.exports = function() {
4+
return `module.exports = ${counter++};`;
5+
};

0 commit comments

Comments
 (0)