-
Notifications
You must be signed in to change notification settings - Fork 488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Config object must not be extendable after first call to get() #473
base: master
Are you sure you want to change the base?
Conversation
@@ -566,6 +566,9 @@ util.makeImmutable = function(object, property, value) { | |||
} | |||
} | |||
|
|||
// Make sure new properties cannot be added in the future | |||
Object.preventExtensions(object); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if this is available in all nodejs versions supported by node-config. Travis tests failing, probably the indication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think the issue comes from Object.preventExtensions
. Another test is suddenly failing but I'm not sure why. Any idea ?
Configuration for module developers
✗ Prototypes are applied by setModuleDefaults even if no previous config exists for the module
TypeError: Cannot read property 'parm1' of undefined
at /home/travis/build/lorenwest/node-config/lib/config.js:1485:37
at Array.forEach (<anonymous>)
at Config.util.extendDeep (/home/travis/build/lorenwest/node-config/lib/config.js:1478:9)
at Config.util.setModuleDefaults (/home/travis/build/lorenwest/node-config/lib/config.js:427:8)
at Object.Prototypes are applied by setModuleDefaults even if no previous config exists for the module (/home/travis/build/lorenwest/node-config/test/2-config-test.js:358:19)
at runTest (/home/travis/build/lorenwest/node-config/node_modules/vows/lib/vows.js:136:26)
at EventEmitter.<anonymous> (/home/travis/build/lorenwest/node-config/node_modules/vows/lib/vows.js:81:9)
at emitOne (events.js:121:20)
at EventEmitter.emit (events.js:211:7)
at EventEmitter.options.Emitter.emit (/home/travis/build/lorenwest/node-config/node_modules/vows/lib/vows.js:241:24)
at /home/travis/build/lorenwest/node-config/node_modules/vows/lib/vows/suite.js:170:45
at _combinedTickCallback (internal/process/next_tick.js:131:7)
at process._tickCallback (internal/process/next_tick.js:180:9)
at Function.Module.runMain (module.js:686:11)
at startup (bootstrap_node.js:187:16)
at bootstrap_node.js:608:3
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are not failing on the main branch, it must be something here.
According to http://node.green/ Object.preventExtensions()
is partially supported on Node 4. I'm not clear if the functionality we need from it is there are not. We could check to see if the preventExtensions
method exists on the Object
class, and if so, add in this extra safety check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My last message was not very well phrased, what I meant is that my modifications broke another, unrelated test. This is true for all node versions on Travis.
The tests added in this branch pass for all versions of Node, even 4. Do you still want to add the check ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm still interested if the other test failures can be resolved without regressions in another feature.
Needs conflict resolution and test fixes. |
For #471