-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: Avoid param reassignment in group_snippet #303
Conversation
const updatedParams = Object.assign({}, params, { | ||
headers: Object.assign({}, params.headers || {}, groupHeaders), | ||
}) |
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.
TIL that our version of k6 doesn't support the spread operator. It was added to a newer version (grafana/k6#3456)
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 not quite happy with this snippet "polluting" the global namespace, essentially making it impossible to create user-defined variables with names like Client
, trimAndRemovePrefix
, etc - it's only possible in custom code snippets (and I'm still not sure whether those should have their own scope - let's have a separate discussion on that)
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.
good point!
We should definitely not reserve those names 🤔
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.
LGTM 👌
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.
🧹 ✨
Description
How to Test
Checklist
Screenshots (if appropriate):
Related PR(s)/Issue(s)