Skip to content

Commit

Permalink
fix(resolveConfig): enable debug mode when defined through package co…
Browse files Browse the repository at this point in the history
…nfig
  • Loading branch information
hasezoey committed Aug 12, 2021
1 parent a2cf747 commit 20b121f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions packages/mongodb-memory-server-core/src/util/resolveConfig.ts
Expand Up @@ -123,9 +123,16 @@ export function envToBool(env: string = ''): boolean {
}

// enable debug if "MONGOMS_DEBUG" is true
if (envToBool(resolveConfig(ResolveConfigVariables.DEBUG))) {
if (envToBool(resolveConfig(ResolveConfigVariables.DEBUG)) && !debug.enabled) {
debug.enable('MongoMS:*');
log('Debug Mode Enabled, through Environment Variable');
}

// run this always after debug is enabled
// run this after env debug enable to be able to debug this function too
findPackageJson();

// enable debug if "config.mongodbMemoryServer.debug" is true
if (envToBool(resolveConfig(ResolveConfigVariables.DEBUG)) && !debug.enabled) {
debug.enable('MongoMS:*');
log('Debug Mode Enabled, through package.json');
}

0 comments on commit 20b121f

Please sign in to comment.