Repository navigation
chore(agents): run the agent tooling tests apart from the package tests - #199
Merged
Merged
Conversation
Publishing runs `npm test` through `prepublishOnly`, and `npm test` also ran the agent tooling's tests in .agents/scripts, which test the hooks, the guard and verify, none of which ship. A slow agent tooling test timing out there broke outline-cli's 3.2.0 publish, and the same setup is here. `npm test` now runs the package's own tests, plus the packed-tarball check, which tests what ships. The tooling's tests move to `npm run test:agents` (vitest.agents.config.ts), which CI runs on every pull request. `npm run verify` runs them when something they read changed since main, through a new `onlyWhenChanged` on its steps, and says it skipped them otherwise. They start after the package tests: two vitest runs side by side made the hook tests time out.
doistbot
reviewed
Dec 3, 2026
doistbot
left a comment
Member
There was a problem hiding this comment.
This PR cleanly splits the agent tooling's tests out of npm test into their own npm run test:agents config and CI step, and adds a conditionally-run tests:agents verify step gated by onlyWhenChanged — with tests covering the skip behavior and CI-equivalence checks keeping verify, package.json and test.yml in sync. No inline issues were flagged. The implementation reuses existing helpers (clearGitEnv, AGENT_DOCS, the verify step machinery) rather than duplicating logic, and a security pass over the new git-env clearing, step-skipping prefix matching, and workflow change found nothing concerning.
I also included a few optional follow-up notes in the details below.
Optional follow-up notes (3)
CODEBASE.md:48: This line was edited to note it runs under
npm test, but the inlineincludeis now stale:vitest.config.tsincludes['**/*.test.ts', '../.agents/scripts/package-contents.test.ts']. Update the summary so the map matches the config (the Testing section below already documents the exception)..agents/scripts/lib/steps.test.ts:160:
expect.arrayContainingonly pins the five prefixes named here, so the rest of the step's list (.claude/,.codex/,.cursor/,lefthook.yml,package-lock.json,src/testing/,src/test-support/) can be removed from.agents/scripts/lib/steps.tswith the whole suite still green — verify would then silently skip the tooling tests when, say,lefthook.ymlor asrc/testing/helper changes, which is the drift this file exists to prevent. Assert the full sorted list (or add the missing prefixes to this array) so a dropped trigger fails a test.vitest.agents.config.ts:14:
.agents/scripts/tsconfig.jsonstill sets"types": ["node", "vitest/globals"], sonpm run type-checkaccepts agent tests that calldescribe/it/expectwithout importing them. The agent runner no longer enables globals (vitest.config.tsdid before the split), so such a test would pass the type check and then fail at runtime undernpm run test:agents. Addglobals: truehere to match the package config and the old single-config setup, or dropvitest/globalsfrom the agent tsconfig.
…tests It runs npm pack to check the tooling stays out of the tarball, so it is a test of the tooling rather than of the package, and it is slow enough to time out inside prepublishOnly. It now runs with the other agent tooling tests, as it does in the other CLIs.
…n unchanged tree Verify's `onlyWhenChanged` step now also runs when nothing changed since the base, as every step does then, and when a changed path no longer exists: instructions.test.ts checks that every path the agent docs name exists, so a deletion or rename can break it. test.yml runs on pushes to main and next too, so both suites run on every merge without being on the publish path. The agent tooling's tsconfig drops the vitest globals, which its vitest config does not enable. The helper folders instructions.test.ts imports come from tree.ts, shared with verify's list, and a test checks every path in that list exists.
Matches the name the other CLIs use for the same list.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Publishing runs
npm testthroughprepublishOnly, andnpm testalso ran the agent tooling's tests in.agents/scripts, which test the hooks, the guard and verify, none of which ship. A slow agent tooling test timing out there broke outline-cli's 3.2.0 publish, and the same setup is here.npm testnow runs only the package's own tests. The tooling's tests,package-contents.test.tsincluded (it runsnpm packto check the tooling stays out of the tarball), move tonpm run test:agents(vitest.agents.config.ts), whichtest.ymlruns right afternpm test.test.ymlnow also runs on pushes tomainandnext, so both suites run on every merge without being on the publish path. Pre-push still runsnpm test, the package's tests only.npm run verifygains atests:agentsstep with a newonlyWhenChangedlist: it runs when something the agent tests read changed sincemain(.agents/, their config, the agent docs,.claude/,.codex/, a Cursor hooks file,lefthook.yml, the workflows,package.json, the lockfile,src/testing/andsrc/test-support/). It also runs when a file was deleted or renamed, sinceinstructions.test.tschecks that every path the agent docs name exists, and when nothing changed, since verify then checks the whole tree. Otherwise it prints that it skipped them because CI runs them, and the skipped step counts as passed. A test checks every path in the list exists,.cursor/aside. The step starts after the package tests: the first verify run with both vitest suites side by side timed out a hook test.The agent tooling's tsconfig no longer loads the vitest globals, which
vitest.agents.config.tsdoes not enable, so type-check rejects a tooling test that relies on them.