-
Notifications
You must be signed in to change notification settings - Fork 0
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
feat: Add zip method #68
Conversation
Co-authored-by: Alex Plischke <alex.plischke@saucelabs.com>
console.error( | ||
`Zip file creation failed for destination: "${dest}", source: "${source}". Error: ${error}.`, | ||
); |
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.
One thing I'm hung up on is whether or not its better to let whoever is invoking the function to print the error. Printing to console is a user facing behaviour and having a low level utility function do that seems more surprising than just throwing the error.
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.
Oops, added this comment, but forgot to submit the review. Fine to disregard, but still wanted to bring it up.
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 agree that an error thrown by a low-level function may be unexpected. However, given that the zipping behavior is determined by user settings in the sauce configuration, such an error could be understandable and helpful.
It allows users to debug and modify their configuration as necessary. This is different from generating JUnit or Sauce reports, where a failure could be misinterpreted as a test failure, as those operations are not directly controlled by the user.
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.
@tianfeng92 Mike is talking about removing this log line and instead throwing the error all the way back to the caller (the runner in that case). The caller (runner) is then the one to handle (i.e. log) the error.
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.
Oops, added this comment, but forgot to submit the review. Fine to disregard, but still wanted to bring it up.
Now that you bring this up, I'd personally prefer that approach. Generally I'm in favor of keeping user facing messaging out of low level libs. Having user facing messages in low level libs, prevents the lib from being used more broadly and robs the caller of controlling what the user should see.
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.
Make sense. Let me draft a PR to address it.
One-line summary
Add zip method: this method receives source directory and destination file and zips file accordingly.