-
Notifications
You must be signed in to change notification settings - Fork 816
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
fix: added exit code on remove #5427
fix: added exit code on remove #5427
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5427 +/- ##
==========================================
- Coverage 59.12% 59.12% -0.01%
==========================================
Files 399 400 +1
Lines 17970 17976 +6
Branches 3558 3558
==========================================
+ Hits 10625 10628 +3
- Misses 6697 6700 +3
Partials 648 648
Continue to review full report at Codecov.
|
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 "print error message, log usage data, exit code 1" pattern seems to exist in lots of different places. Maybe it would be worthwhile to put a utility function in amplify-cli-core like exitWithError(err, friendlyMessage)
that can be used in all of these places
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 still think it might be worthwhile to encompass the print error, log usage data, exit pattern within a function in cli-core. That function can use the exitOnNextTick
function and will give us an easy way to make sure the cli exits properly when adding new flows in the future.
// amplify delete run method calls process.exit() in certain situations. To avoid this affecting tests when they run, spy on process.exit() | ||
// calls and intercept them, performing a NOP, instead. | ||
// | ||
// https://stackoverflow.com/questions/46148169/stubbing-process-exit-with-jest | ||
const mockExit = jest.spyOn(process, 'exit').mockImplementation(() => undefined as never); | ||
|
||
import { UnknownArgumentError } from 'amplify-cli-core'; |
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.
nit: doesn't look like this is actually used in the test?
* fix: added exit code on remove * fix: added exit code * fix: exit on next tick * test: fixed abort test * test: fixed delete.test.ts
* fix: added exit code on remove * fix: added exit code * fix: exit on next tick * test: fixed abort test * test: fixed delete.test.ts
This pull request has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Issue #, if available:
Description of changes:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.