Skip to content

Commit 9d766ea

Browse files
committed
test: cover a two-level re-export and the filesystem cache
1 parent d6c19d4 commit 9d766ea

6 files changed

Lines changed: 40 additions & 14 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./target";
2+
export const own = 1;

‎test/watchCases/cache/unaffected-deleted-reexport-target/0/index.js‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
const deleted = WATCH_STEP === "1";
22

3-
for (const [name, load, keys] of [
4-
["export { a as r } from", () => require("./named"), ["own", "r"]],
5-
["export * from", () => require("./star"), ["a", "own"]]
3+
for (const [name, load, keys, deletedKeys] of [
4+
["export { a as r } from", () => require("./named"), ["own", "r"], ["own"]],
5+
["export * from", () => require("./star"), ["a", "own"], ["own"]],
6+
[
7+
"export * from a module re-exporting it",
8+
() => require("./top"),
9+
["a", "own", "top"],
10+
["own", "top"]
11+
]
612
]) {
713
it(`should follow ${name} of a deleted and restored module`, () => {
814
if (deleted) {
915
expect(load).toThrow(/Cannot find module '\.\/target'/);
1016
// the exports defined before the throw stay in the module cache
11-
expect(Object.keys(load())).toEqual(["own"]);
17+
expect(Object.keys(load()).sort()).toEqual(deletedKeys);
1218
return;
1319
}
1420
expect(Object.keys(load()).sort()).toEqual(keys);
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from "./deep";
2+
export const top = 1;
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
"use strict";
22

3-
module.exports = [
4-
[/Module not found/, /Can't resolve '\.\/target'/],
5-
[/Module not found/, /Can't resolve '\.\/target'/]
6-
];
3+
const errors = [1, 2, 3].map(() => [
4+
/Module not found/,
5+
/Can't resolve '\.\/target'/
6+
]);
7+
8+
module.exports = [...errors, ...errors];
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
"use strict";
2+
3+
module.exports = {
4+
/**
5+
* @param {number} index compiler index
6+
* @returns {string} bundle containing the runtime assertions
7+
*/
8+
findBundle(index) {
9+
return `bundle${index}.js`;
10+
}
11+
};
Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
"use strict";
22

3-
/** @type {import("../../../../").Configuration} */
4-
module.exports = {
5-
mode: "development",
6-
cache: { type: "memory" },
7-
experiments: { cacheUnaffected: true }
8-
};
3+
/** @type {import("../../../../").Configuration[]} */
4+
module.exports = /** @type {const} */ (["memory", "filesystem"]).map(
5+
(type, index) => ({
6+
mode: "development",
7+
cache: { type },
8+
output: { filename: `bundle${index}.js`, clean: false },
9+
experiments: { cacheUnaffected: true }
10+
})
11+
);

0 commit comments

Comments
 (0)