Skip to content

Commit

Permalink
test(core): update module federation unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ScriptedAlchemy authored and ahabhgk committed Apr 16, 2024
1 parent 8d57128 commit e7999a6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
let warnings = [];
let oldWarn;

// clean federation globals from previous executions
if (globalThis.__FEDERATION__) {
globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__ = {};
//@ts-ignore
globalThis.__FEDERATION__.__INSTANCES__.map((i) => {
i.moduleCache.clear();
if (globalThis[i.name]) {
delete globalThis[i.name];
}
});
globalThis.__FEDERATION__.__INSTANCES__ = [];
}

beforeEach(done => {
oldWarn = console.warn;
console.warn = m => warnings.push(m);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
if (globalThis.__FEDERATION__) {
globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__ = {};
//@ts-ignore
globalThis.__FEDERATION__.__INSTANCES__.map((i) => {
i.moduleCache.clear();
if (globalThis[i.name]) {
delete globalThis[i.name];
}
});
globalThis.__FEDERATION__.__INSTANCES__ = [];
}

it("should load the component from container", async () => {
await __webpack_init_sharing__("test-scope");

Expand Down

0 comments on commit e7999a6

Please sign in to comment.