Skip to content

Commit c980955

Browse files
committed
fix: add missing clearModule
1 parent 2201edf commit c980955

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

packages/runtime/assets/harness-module-system.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,17 @@
9191
// Call the original define with the wrapped factory
9292
return originalDefine.call(this, wrappedFactory, moduleId, dependencyMap);
9393
};
94+
95+
// Implement __clearModule
96+
// This allows the test runner to re-evaluate modules by clearing them from the cache
97+
globalObject.__clearModule = function (moduleId) {
98+
if (globalObject.__r && globalObject.__r.getModules) {
99+
const modules = globalObject.__r.getModules();
100+
if (modules && modules.has(moduleId)) {
101+
modules.delete(moduleId);
102+
}
103+
}
104+
};
94105
})(
95106
typeof globalThis !== 'undefined'
96107
? globalThis

0 commit comments

Comments
 (0)