Merge pull request #15563 from cool-little-fish/fix-12408

fix: hmr module.check api when called with false
This commit is contained in:
Tobias Koppers 2022-04-07 14:20:40 +02:00 committed by GitHub
commit 360373d76e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,3 @@
export var value = 1;
---
export var value = 2;

View File

@ -0,0 +1,6 @@
import { value } from "./file";
it("call module.check api with false should return updatedModules correctly", function (done) {
expect(value).toBe(1);
NEXT(require("./update")(done));
});

View File

@ -0,0 +1,15 @@
module.exports = function (done) {
return function (err, stats) {
if (err) return done(err);
module.hot
.check(false)
.then(updatedModules => {
if (!updatedModules) return done(new Error("No update available"));
expect(updatedModules).toContain("./file.js");
done();
})
.catch(err => {
done(err);
});
};
};