test-unbranded-emitter
Build and test the @typespec/http-client-python emitter. Use this skill whenever the user wants to test their local changes to the emitter, run the generator test suite, check if their http-client-python changes are passing, or validate a fix. Triggers on phrases like "test the emitter", "run tests", "check if my changes pass", "run test:generator", "run CI", or any mention of testing/validating changes in the emitter package.
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 5.9k
- Forks
- 423
01 前言 Front Matter
- name
- test-unbranded-emitter
- description
- Build and test the @typespec/http-client-python emitter. Use this skill whenever the user wants to test their local changes to the emitter, run the generator test suite, check if their http-client-python changes are passing, or validate a fix. Triggers on phrases like "test the emitter", "run tests", "check if my changes pass", "run test:generator", "run CI", or any mention of testing/validating changes in the emitter package.
03 SKILL.md 正文
Test Emitter Skill
Builds and tests @typespec/http-client-python to validate local changes.
Automatically regenerates if the generated code is stale.
Paths
All paths are relative to the http-client-python package root:
~/Desktop/github/typespec/packages/http-client-python
| Item | Path |
|---|---|
| Package root | ~/Desktop/github/typespec/packages/http-client-python |
| Emitter source | emitter/src |
| Generated (unbranded) | generator/test/unbranded/generated |
| Generated (azure) | generator/test/azure/generated |
| Regenerate marker | .last-regenerate |
Workflow
Step 1: Build the emitter
cd ~/Desktop/github/typespec/packages/http-client-python
npm run build
Check for TypeScript compilation errors. If the build fails, report the errors to the user and stop — do not proceed to testing.
Step 2: Check if regeneration is needed
Regeneration is needed if ANY of these conditions are true:
-
Generated folder doesn't exist or is empty:
cd ~/Desktop/github/typespec/packages/http-client-python if [ ! -d "generator/test/unbranded/generated" ] \ || [ -z "$(ls -A generator/test/unbranded/generated 2> /dev/null)" ]; then echo "Unbranded generated folder is empty - regeneration needed" fi if [ ! -d "generator/test/azure/generated" ] \ || [ -z "$(ls -A generator/test/azure/generated 2> /dev/null)" ]; then echo "Azure generated folder is empty - regeneration needed" fi -
No regenerate marker file exists:
if [ ! -f ".last-regenerate" ]; then echo "No regenerate marker - regeneration needed" fi -
Emitter source files are newer than the marker:
if [ -n "$(find emitter/src -newer .last-regenerate -type f 2> /dev/null | head -1)" ]; then echo "Emitter source changed since last regenerate - regeneration needed" fi
Step 3: Regenerate if needed
If any condition from Step 2 is true:
cd ~/Desktop/github/typespec/packages/http-client-python
echo "Regenerating test clients..."
npm run regenerate
After successful regeneration, update the marker:
touch .last-regenerate
If regeneration fails, report the error and stop.
If regeneration is NOT needed, inform the user:
"Generated code is up to date (source unchanged since last regeneration). Skipping regenerate."
Step 4: Run the generator test suite
cd ~/Desktop/github/typespec/packages/http-client-python
npm run ci
This runs:
test:emitter- vitest unit tests for the emitterci:generator- pytest tests against generated code
The full CI can take several minutes. Keep the user informed that it's running.
Step 5: Report results
- If tests pass: Confirm success and summarize any notable output (warnings, skipped tests, etc.)
- If tests fail: Show the failing test names and error messages clearly. Offer to help debug or investigate specific failures.
Integration with diff-upstream
Both skills share the regeneration marker system:
diff-upstreamalways regenerates and updates.last-regeneratetest-unbranded-emitterchecks this marker and skips regeneration if fresh
Efficient workflow:
diff-upstream → test-unbranded-emitter
The second command will skip regeneration since diff-upstream just did it.
Standalone workflow:
test-unbranded-emitter
Will regenerate only if source changed since last run.
Notes
Regeneration takes time
npm run regenerate can take 2-3 minutes. The staleness check avoids this delay
when the user is iterating on test fixes (not emitter changes).
Test types
| Command | What it runs | Duration |
|---|---|---|
npm run test:emitter |
vitest unit tests only | ~5 seconds |
npm run test:generator |
pytest only (no vitest) | ~2 minutes |
npm run ci |
vitest + pytest (full CI) | ~2-3 minutes |
This skill runs npm run ci (full CI). If the user wants just unit tests or
just pytest, they can ask specifically.
Known flaky test
The test server teardown sometimes fails with ProcessLookupError - this is a
pre-existing infrastructure issue, not a test failure. All actual tests may pass
even if you see this error at the end.
Force regeneration
If the user suspects stale generated code despite the marker, they can force regeneration:
rm ~/Desktop/github/typespec/packages/http-client-python/.last-regenerate
Then run the skill again.
Gitignore
Ensure this entry is in the package's .gitignore:
.last-regenerate
04 同仓库更多 Skills
generate-from-typespec
Generate Python SDK code from a TypeSpec specification using the local emitter. Use this skill when the user wants to generate/regenerate a Python client from a TypeSpec spec, provides a GitHub URL or local path to a TypeSpec project, or says things like "generate from this spec", "emit Python from this tsp", "regenerate the SDK", or "compile this TypeSpec for Python".
diff-upstream
Regenerate the local emitter and diff the generated code against the upstream baseline checked into autorest.python. Use this skill when the user wants to see how their emitter changes affect generated code compared to what's currently in production, says things like "diff upstream", "compare to baseline", "what changed vs production", "show me the diff", "how does this affect generated code", or wants to validate their changes produce the expected output differences.
writing-python-sdk-spector-mock-api-tests
Writes TypeSpec http-client-python generator mock API tests (azure/unbranded/shared) from a Spector case. Use when given a Spector case link or a PR link that modifies Spector cases under http-specs/azure-http-specs.
pnpm-format
Format the codebase with pnpm and recover from common formatting failures.
minimal-repro
Help create a minimal reproduction for a TypeSpec compiler or emitter bug. Use when a user provides TypeSpec source (pasted code or a GitHub URL) and describes an issue. Reproduces locally and reduces to a single-file repro.
http-client-python-bump-and-release
Create a PR to bump TypeSpec/Azure Tools dependencies, update peer dependencies, or release a new version of the http-client-python package.