Repository navigation
Ensure options as passed to plugins is not modified - #11796
sleepwithcoffee wants to merge 2 commits into
Conversation
|
seems that this runs deeper than I thought. Even in our code base, we tend to modify On top of that, modifying this can possibly make other plugins break if they went for the 'hacky' way. |
|
@sleepwithcoffee great thanks for giving that a spin!
When you spot such cases, do you think they intentionally update the global object, or it's more not envisioned side effect?
The ideal approach is to in first place, refactor all approached tests to rely on |
|
I would say we have to refactor to decouple the test cases first. Right now, it is critical to run tests in order due to the way objects are initialized which is not good at all! My take is every test should be dependent from each other. Tt makes our tests less error-prone and compatible with parallelization. |
|
@sleepwithcoffee yes, that's a big problem with old tests, which focused to much on confirming implementation details which should not be the case. Refactoring test to rely on |
|
Created PR #11812 to address the issue with tests, can merge that one first before moving on this one |
Closes: #2582
this.options = Object.assign({}, options);Consideration for next step: create a base class for all plugins or groups of plugins e.g. AwsBasePlugin -> then in the base class constructor we initiate some basic properties rather than copy the same init code in all plugins.
This will avoid code duplication but the trade-off will be nested inheritance.