-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Warn users on importing dependencies as absolute paths #2078
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2078 +/- ##
==========================================
- Coverage 72.16% 72.08% -0.08%
==========================================
Files 181 180 -1
Lines 14289 14248 -41
==========================================
- Hits 10311 10271 -40
Misses 3351 3351
+ Partials 627 626 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
js/initcontext.go
Outdated
i.logger.Warnf("you import '%s' with an absolute path, this won't be cross platform and likely will not work if"+ | ||
" you move the script between machines. Also it might not work on k6 cloud if it doesn't have `file://` in front", |
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.logger.Warnf("you import '%s' with an absolute path, this won't be cross platform and likely will not work if"+ | |
" you move the script between machines. Also it might not work on k6 cloud if it doesn't have `file://` in front", | |
i.logger.Warnf("you import '%s' with an absolute path, this won't be cross platform and likely will not work if"+ | |
" you move the script between machines or in cloud. You should use `file://` in front to have the full cross platform and cloud finally supported", |
I would make "the suggestion" more explicit
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.
The thing is that "full cross platform" isn't true, as just moving the script between machines will still not work. It will work if you archive it and run the archive, but not if you than unarchive it on a different machine.
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.
The reality of it is that the correct way for something to be cross-platform and cross-machine (as the OS is not the only problem) is to not use absolute paths at all.
So I really do prefer if that is the sentiment we sent more than "this won't work in the cloud if you are on Windows and use absolute paths without file://"
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.
👎, this is going to trigger for *nix file paths, which are not problematic. Also, the warning will be shown multiple times, once for every VU init.
They still are not
|
See my other point about the warning being shown once per VU, I submitted my review prematurely and edited the message. Also, if you want this warning to be for all absolute paths (which I don't), it should also be shown for |
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 in general, made an inline comment with a suggestion for a better warning message
Co-authored-by: na-- <n@andreev.sh>
part of #1089