Closed dspies closed 8 years ago
Hi,
I'm ok to clone the user options. However, I prefer using the "Object.assign" approach, because if one option is a function (for a callback for example), with JSON.stringify and JSON.parse, it will not work:
Object.assign({ }, options.args);
So, can you fix you commit from:
args = JSON.parse(JSON.stringify(options.args)) || [];
To:
args = options.args ? Object.assign({ }, options.args) || [];
Many thanks for your help
Cheers
And maybe adding an unit test to check if we not use the same object reference
Cheers
Agree on both items. I wasn't even thinking about functions or protractor options outside of my own, so
args = options.args ? Object.assign({ }, options.args) || [];
would be a good idea. As for the test, I have been trying to replicate the issue in a test, but have been unable to so far. I thought simply running the protractor task twice would be enough, but it is not reproducing the error I was getting in my build. I will investigate my build further and see if I can determine the issue.
Breaks the reference to user-supplied protractor options by cloning the options object before it is used in the gulp-stream function. The second call to gulp-stream will no longer have the args generated in the first run supplied as options.arg in the subsequent runs.