node-red-node-test-helper
node-red-node-test-helper copied to clipboard
helper.settings() cannot be called more than once with the same settings instance as parameter
I am very happy that it is now possible to initialise the helper with settings. However I found out that calling helper.settings(userSettings) more than once with the same instance of userSettings will cause the helper.load() to fail. This will happen if one reuses the userSettings for multiple tests.
This is because the helper defines getters and setters on the userSettings.functionGlobalContext. When it tries to do so for the second time it throws an exception, because it cannot overwrite the getters and setters.
As a work-around, it is possible to pass in a new instance of userSettings (without getters and setters) to helper.settings() for every invocation.