-
Notifications
You must be signed in to change notification settings - Fork 1.1k
chore(cli): improve test infrastructure #1020
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
base: main
Are you sure you want to change the base?
chore(cli): improve test infrastructure #1020
Conversation
- Move express from dependencies to devDependencies (only used in tests) - Add defensive check for child.pid in cli-runner.ts - Extract test URIs to constants (TEST_URI_ENV, TEST_URI_RESOURCE) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| resources: [ | ||
| { | ||
| uri: "test://resource", | ||
| uri: TEST_URI_RESOURCE, |
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 seems a bit extra but Claude really wanted to make this a constant :)
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 all for constants.
| } else if (child.pid) { | ||
| // On Unix, kill the process group | ||
| process.kill(-child.pid!, "SIGTERM"); | ||
| process.kill(-child.pid, "SIGTERM"); |
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.
Why the dash before child.pid? It should be a number, but I don't think it should be negative.
| resources: [ | ||
| { | ||
| uri: "test://resource", | ||
| uri: TEST_URI_RESOURCE, |
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 all for constants.
Summary
Fast follow improvements to the CLI test infrastructure from PR #1012:
expressfromdependenciestodevDependenciesin cli/package.json (it's only used for test HTTP servers)child.pidbefore process kill in cli-runner.tstest://env,test://resource) to named constants for better maintainabilityTest plan
npm testpasses🦉 Generated with Claude Code