Skip to content

Commit

Permalink
fix: undefined issue with some modules
Browse files Browse the repository at this point in the history
  • Loading branch information
satanTime committed Nov 19, 2023
1 parent d62683e commit 8045447
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions libs/ng-mocks/src/lib/mock-builder/promise/init-ng-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const isExportedOnRoot = (
configDef: Map<any, any>,
): undefined | Type<any> => {
const cnfInstance = configInstance.get(def);
const cnfDef = configDef.get(def);
const cnfDef = configDef.get(def) || /* istanbul ignore next */ {};

if (isNgDef(def, 'm') && cnfDef.onRoot) {
return def;
Expand Down Expand Up @@ -116,10 +116,14 @@ export default ({ configDefault, keepDef, mockDef, replaceDef }: BuilderData, de
if (!def || processed.indexOf(def) !== -1) {
continue;
}

const cnfDef = ngMocksUniverse.config.get(def);
const cnfDef = ngMocksUniverse.config.get(def) || /* istanbul ignore next */ { __set: true };
processed.push(def);
cnfDef.onRoot = cnfDef.onRoot || !cnfDef.dependency;
// istanbul ignore if
if (cnfDef.__set) {
cnfDef.__set = undefined;
ngMocksUniverse.config.set(def, cnfDef);
}

if (isNgDef(def, 'm') && cnfDef.onRoot) {
handleDef(meta, def, defProviders);
Expand Down

0 comments on commit 8045447

Please sign in to comment.