node-red / node-red-node-test-helper

A test framework for Node-RED nodes
Apache License 2.0
57 stars 41 forks source link

Add customisable userSettings #34

Closed kwakwaversal closed 5 years ago

kwakwaversal commented 5 years ago

userSettings can now be passed in on initialization via helper.init(runtimepath, userSettings) as well as during the runtime using helper.settings(userSettings).

This makes it easier for unit tests to emulate their production environment.

Fixes #21

knolleary commented 5 years ago

Thanks for this - sorry for the delay in reviewing, but all looks good.

👍 🚀

cdlans commented 5 years ago

Thanks for this feature! However this implementation has the same issue #35 as my PR #23 had...

knolleary commented 5 years ago

@cdlans my apologies. I forgot about #23 and had a specific request to make settings available and this PR popped out.

cdlans commented 5 years ago

No problem. I am happy the feature is implemented now. But do you think the issue #35 could be solved? Maybe by cloning the userSettings parameter before modifying it? If not, then I think it should be documented somewhere that the parameter is modified and cannot be reused.

cdlans commented 5 years ago

@knolleary do you think cloning the userSettings before modifying it is a good idea? I would be happy to issue a PR.