feat(dev): add option --on-exit=remove#13342
Conversation
Co-authored-by: Codex
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
📝 WalkthroughWalkthroughThe dev command option Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
… into codex/assess-onexit-enum-option
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/serverless/test/unit/lib/plugins/aws/dev.test.js`:
- Around line 80-92: The test currently validates the thrown message but then
uses a try/catch that won’t fail if validateOnExitOption() stops throwing;
update the test for awsDev.validateOnExitOption() so it asserts both the thrown
message and the error.code in one check — either call validateOnExitOption()
inside a try/catch that calls fail() if no error is thrown and then assert
caughtError.code === 'INVALID_DEV_ON_EXIT_OPTION', or use Jest’s expect(() =>
awsDev.validateOnExitOption()).toThrow() variant that inspects the thrown error
and asserts its message and code together; ensure you reference
awsDev.options['on-exit'] === 'foo' and the error code
'INVALID_DEV_ON_EXIT_OPTION' in the assertion.
Summary
serverless devexit flag from--remove-on-exitto--on-exitinpackages/serverless/lib/cli/commands-schema.js--on-exit=removeis accepted inpackages/serverless/lib/plugins/aws/dev/index.js--on-exitis omitted (show reminder warning)docs/sf/providers/aws/cli-reference/dev.md--on-exitvalues inpackages/serverless/test/unit/lib/plugins/aws/dev.test.jsTest plan
npm run test:unit -w @serverless/framework -- packages/serverless/test/unit/lib/plugins/aws/dev.test.js1 passed, 1 totalsuite and3 passed, 3 totaltestsHow to test
serverless dev --on-exit=remove, pressCtrl+C, and confirm the remove prompt appears.serverless dev --on-exit=fooand confirm it fails withINVALID_DEV_ON_EXIT_OPTION.serverless devwithout--on-exitand confirm the default reminder warning is shown on exit.serverless dev --remove-on-exitand confirm the option is rejected as unsupported.Summary by CodeRabbit
Documentation
Chores
Tests