Follow Discord
Sweep 20 Nov 2026 · 19:55Z Build v2.1.330 547 read Stable v2.1.323 Latest v2.1.330 Next v2.1.330 Feeds RSS JSON llms.txt llms-full.txt Unofficial
One change · claude-code

Test a mod changedplugins/mods/test

Nearest release: v2.1.326, published 3 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.

Upstream edited this page at 16 Nov 2026 22:20 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 16 Nov 2026 22:37 UTC.

Upstream edited
Recorded here
Lines+4added
Lines−3removed
From line 350 where the diff opens
First seen 1 Oct 2026 this site's first read of the page
Recorded edits14to this page, all time

The whole hunk

from line 350, old and new numbered
/
lines
from line 350
350350* **`tier`**: call it once at the top of the test file, as in `tier('prepend')`, to load your mod as `prepend`, `append`, or `builtin`, its place in the [order mods run in](https://code.claude.com/docs/en/plugins/mods/events.md#the-order-mods-run-in). Without it, your mod loads as `user`.
351351* **`plugins`**: pass `test` an options object ahead of the test body. Its `plugins` array holds mods you write inline, each with a `name` and a `register` function. To load one somewhere other than `user`, add `tier` to it.
352352 
353This test file loads the [policy mod from the admin page](https://code.claude.com/docs/en/plugins/mods/admin.md#enforce-a-policy-with-a-mod-of-your-own) first. It checks that the policy mod refuses a mod that starts a process and allows one that doesn't:
353This test file loads the [policy mod from the admin page](https://code.claude.com/docs/en/plugins/mods/admin.md#enforce-a-policy-with-a-mod-of-your-own) first. It checks that the policy mod stops a mod that starts a process and allows one that doesn't:
354354 
355355```typescript acme-guard/tests/guard.test.ts theme={null}
356356import { expect, test, tier } from 'claude-code/testing'
from line 388
388388 } catch (error) {
389389 message = error.message
390390 }
391 expect(message).toBe('runner: refused by acme-guard: Acme policy: mods may not call process.run')
391 // "hooks module left out" on v2.1.326 or later, "refused" on earlier versions
392 expect(message).toMatch(/^runner: (hooks module left out|refused) by acme-guard/)
392393})
393394 
394395test('admits a mod that starts no process', { plugins: [reader] }, async ($, on) => {
from line 402
401402 
402403In your shell, run `claude plugin test` from the `acme-guard` directory. Both tests pass with the policy mod as the admin page shows it.
403404 
404The kit loads every mod at the test's first call on `$`. When your mod refuses one, that call throws, and the message names the refused mod, the mod that refused it, and your reason. In the second test nothing is refused, so `reader` answers the tool call before it reaches the stub.
405The kit loads every mod at the test's first call on `$`. When your mod stops one, that call throws, and the message names both mods. In the second test nothing is stopped, so `reader` answers the tool call before it reaches the stub.
405406 
406407## Next steps
407408 
Feedback