Skip to content

chore(agents): run the agent tooling tests apart from the package tests - #199

Merged
scottlovegrove merged 4 commits into
mainfrom
scottl/split-agent-tests
Dec 3, 2026
Merged

scottlovegrove merged 4 commits into
mainfrom
scottl/split-agent-tests

Conversation

@scottlovegrove

@scottlovegrove scottlovegrove commented Dec 3, 2026 •

Copy link
Copy Markdown
Collaborator

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 only the package's own tests. The tooling's tests, package-contents.test.ts included (it runs npm pack to check the tooling stays out of the tarball), move to npm run test:agents (vitest.agents.config.ts), which test.yml runs right after npm test. test.yml now also runs on pushes to main and next, so both suites run on every merge without being on the publish path. Pre-push still runs npm test, the package's tests only.

npm run verify gains a tests:agents step with a new onlyWhenChanged list: it runs when something the agent tests read changed since main (.agents/, their config, the agent docs, .claude/, .codex/, a Cursor hooks file, lefthook.yml, the workflows, package.json, the lockfile, src/testing/ and src/test-support/). It also runs when a file was deleted or renamed, since instructions.test.ts checks 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.ts does not enable, so type-check rejects a tooling test that relies on them.

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.
@scottlovegrove scottlovegrove self-assigned this Dec 3, 2026

@doistbot doistbot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
  • P3 CODEBASE.md:48: This line was edited to note it runs under npm test, but the inline include is now stale: vitest.config.ts includes ['**/*.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).
  • P3 .agents/scripts/lib/steps.test.ts:160: expect.arrayContaining only 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.ts with the whole suite still green — verify would then silently skip the tooling tests when, say, lefthook.yml or a src/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.
  • P3 vitest.agents.config.ts:14: .agents/scripts/tsconfig.json still sets "types": ["node", "vitest/globals"], so npm run type-check accepts agent tests that call describe/it/expect without importing them. The agent runner no longer enables globals (vitest.config.ts did before the split), so such a test would pass the type check and then fail at runtime under npm run test:agents. Add globals: true here to match the package config and the old single-config setup, or drop vitest/globals from the agent tsconfig.

Share Feedback • Review Logs • Trace

…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.
@scottlovegrove
scottlovegrove merged commit 43eae97 into main Dec 3, 2026
6 checks passed
@scottlovegrove
scottlovegrove deleted the scottl/split-agent-tests branch December 3, 2026 16:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants