Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
"classnames": "2.5.1",
"common-tags": "1.8.2",
"compression": "1.8.1",
"config": "4.3.0",
"config": "4.4.1",
"core-js": "3.49.0",
"deep-eql": "4.1.3",
"deepcopy": "2.1.0",
Expand Down
13 changes: 12 additions & 1 deletion tests/unit/helpers_node.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,18 @@ export const getFakeConfig = (
);
}
}
return Object.assign(Util.cloneDeep(config), params);
// `Util.cloneDeep` walks enumerable string keys via `for...in`, which skips
// node-config's private symbol (used internally by `.get()`) and the
// non-enumerable `util` property. Copy both so `.get()` works on the clone.
const fakeConfig = Util.cloneDeep(config);
for (const sym of Object.getOwnPropertySymbols(config)) {
fakeConfig[sym] = config[sym];
}
const utilDescriptor = Object.getOwnPropertyDescriptor(config, 'util');
if (utilDescriptor) {
Object.defineProperty(fakeConfig, 'util', utilDescriptor);
}
return Object.assign(fakeConfig, params);
};

export const getFakeLogger = (params = {}) => {
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3813,10 +3813,10 @@ concurrently@^9.2.1:
tree-kill "1.2.2"
yargs "17.7.2"

config@4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/config/-/config-4.3.0.tgz#3310b972ac785e8124ec891d1cce81f767bf4561"
integrity sha512-nY/JbYPBxOCTC+Kj9dUf21t49VxwsL6GXRsAxlTY9N6MBTx/6TBQgT2t5PsAY+XUCMCNudARJPevUZeN3NhyHQ==
config@4.4.1:
version "4.4.1"
resolved "https://registry.yarnpkg.com/config/-/config-4.4.1.tgz#01e3f6bdd261ccf211a4fdb2f1b319aa5a2928ad"
integrity sha512-XfN4Q4+wBKkGtgMyQ+5ayjepdb0MrdiGKfBr0G1PTLx9rnqsX+Xiw03LEUtSALZU0UVfcFp6+xYV0NL8HLF94g==
dependencies:
json5 "^2.2.3"

Expand Down