Skip to content

Commit

Permalink
style(resolveConfig): add "filename" to logs
Browse files Browse the repository at this point in the history
  • Loading branch information
hasezoey committed Feb 21, 2021
1 parent 4d9de37 commit 7809fcd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/mongodb-memory-server-core/src/util/resolveConfig.ts
Expand Up @@ -47,10 +47,12 @@ let packageJsonConfig: Record<string, string> = {};
*/
export function findPackageJson(directory?: string): Record<string, string> {
for (const found of finder(directory || process.cwd()) as CustomFinderIterator) {
log(`findPackageJson: Found package.json"`);
// This is an hidden property, using this because an "for..of" loop dosnt return the "filename" value that is besides the "done" and "value" value
const filename = found.__path as string;
log(`findPackageJson: Found package.json at "${filename}"`);

if (Object.keys(found?.config?.mongodbMemoryServer ?? {}).length > 0) {
log(`findPackageJson: Found package with non-empty config field"`);
log(`findPackageJson: Found package with non-empty config field at "${filename}"`);

// the optional chaining is needed, because typescript wont accept an "isNullOrUndefined" in the if with "&& Object.keys"
packageJsonConfig = found?.config?.mongodbMemoryServer;
Expand Down

0 comments on commit 7809fcd

Please sign in to comment.