Skip to content

Commit 752f464

Browse files
committed
test(html): assert the HMR concatenation bailout reason instead of only the rendered content
1 parent 3dc68bb commit 752f464

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import html from "./page.html";
22

3-
it("should keep an HTML module out of concatenation when HMR is enabled", () => {
3+
it("should report why the HTML module cannot be concatenated", () => {
4+
const module = __STATS__.modules.find((m) => m.name.includes("page.html"));
5+
expect(module.optimizationBailout).toContainEqual(
6+
expect.stringContaining("HTML module needs its own module scope for HMR")
7+
);
8+
});
9+
10+
it("should still render the HTML module's content", () => {
411
expect(html).toContain("<p>hmr page</p>");
512
});

‎test/configCases/html/concatenation-hmr-bailout/webpack.config.js‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ module.exports = {
2222
concatenateModules: true
2323
},
2424
plugins: [new HotModuleReplacementPlugin()],
25+
stats: {
26+
optimizationBailout: true
27+
},
2528
experiments: {
2629
html: true
2730
}

0 commit comments

Comments
 (0)