Author tests for new ai-projects GA features
When to Use
- After
apply-post-emitter-editshas merged in new public API surface AND that surface is not underproject.beta.*. - A new GA class, method, or namespace was added that has no test coverage yet under
test/.
Inputs
- The api-surface diff JSON from the
author-samplesskill (or recompute via ../author-samples/prompts/diff-api-surface.prompt.md). - Existing test patterns in test/snippets.spec.ts.
Procedure
Run from sdk/ai/ai-projects/.
Step 1: Filter to GA surface only
From the api-surface diff, drop every entry where isBeta === true or where the namespace path matches *.beta.* / Beta*. Beta surface is intentionally not test-covered by this skill.
Step 2: Scaffold spec file(s)
For each remaining feature, generate a Vitest spec at test/<feature>.spec.ts (or extend an existing related spec) using templates/test-skeleton.spec.ts.
Conventions taken from test/snippets.spec.ts:
- Imports:
it,describefromvitest;AIProjectClientfrom../src/index.js;DefaultAzureCredentialfrom@azure/identity; types viaimport type. - Endpoint from
process.env["FOUNDRY_PROJECT_ENDPOINT"], model fromprocess.env["FOUNDRY_MODEL_NAME"]. - Prefer
it.skip(...)with aTODO(<feature>): unskip after recording addedcomment for every new test, so the suite stays green until a human captures recordings.
Step 3: Verify compilation and linting
npx tsc -p tsconfig.test.node.json --noEmit
npx eslint test/<new-or-edited-spec>.ts
Pass every new or edited spec path to the same ESLint invocation. If this skill is a documented no-op and no test files changed, skip ESLint. The TypeScript command must still pass.
Do not use npm run test:node as a compilation check. It runs the package's existing live and recorded suites and can stall or fail for service/environment reasons unrelated to the scaffolded tests.
Step 4: Hand off
Done. Next: the update-changelog skill.
Out of scope
- This skill does not create recordings (
assets.json,_recordings/). Surface to the human if a recording is needed. - This skill does not test beta surface. Beta features live or die by samples + manual verification.
Notes
- Watch for cascade renames from
apply-post-emitter-edits. If a method on the public surface was renamed (e.g.listSessionFiles→getSessionFiles), the TypeScript check can fail on existing specs that referenced the old name. Patch those call sites as part of this skill. Cross-reference the rename table in ../apply-post-emitter-edits/references/post-emitter-workarounds.md.