Skip to content

Commit 95eab50

Browse files
test(dll): cover exports-only DLL manifest invalidation
The existing transition changed buildMeta and exports together, so a rebuild check comparing buildMeta alone still passed. Add a buildMeta-only step and an exports-only step whose missing named export must be reported.
1 parent e72db32 commit 95eab50

5 files changed

Lines changed: 67 additions & 0 deletions

File tree

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import value, { added } from "dll/item";
2+
3+
const path = require("path");
4+
const probe = JSON.parse(
5+
require("fs").readFileSync(
6+
path.join(STATS_JSON.outputPath, "delegated-cache-probe.json"),
7+
"utf8"
8+
)
9+
);
10+
11+
it("should rebuild DelegatedModule when only the DLL manifest buildMeta changes", () => {
12+
expect(value).toBe("dll-default");
13+
expect(added).toBe("dll-added");
14+
});
15+
16+
it("should build DelegatedModule for the changed buildMeta", () => {
17+
expect(probe).toEqual({ built: 1, reused: 0 });
18+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "function(id) { return { default: 'dll-default', added: 'dll-added' }; }",
3+
"content": {
4+
"./item.js": {
5+
"id": "./item.js",
6+
"buildMeta": {
7+
"exportsType": "namespace",
8+
"strictHarmonyModule": true
9+
},
10+
"exports": ["added", "default"]
11+
}
12+
}
13+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import value, { added } from "dll/item";
2+
3+
const path = require("path");
4+
const probe = JSON.parse(
5+
require("fs").readFileSync(
6+
path.join(STATS_JSON.outputPath, "delegated-cache-probe.json"),
7+
"utf8"
8+
)
9+
);
10+
11+
it("should rebuild DelegatedModule when only the DLL manifest exports change", () => {
12+
expect(value).toBe("dll-default");
13+
expect(added).toBe("dll-added");
14+
});
15+
16+
it("should build DelegatedModule for the changed exports", () => {
17+
expect(probe).toEqual({ built: 1, reused: 0 });
18+
});
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "function(id) { return { default: 'dll-default', added: 'dll-added' }; }",
3+
"content": {
4+
"./item.js": {
5+
"id": "./item.js",
6+
"buildMeta": {
7+
"exportsType": "namespace",
8+
"strictHarmonyModule": true
9+
},
10+
"exports": ["default"]
11+
}
12+
}
13+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"use strict";
2+
3+
// The rebuilt StaticExportsDependency no longer provides `added`; a stale one
4+
// would keep the import silent.
5+
module.exports = [[/export 'added'.+was not found in 'dll\/item'/]];

0 commit comments

Comments
 (0)