Answer: Use a mock clock created with `mock.clock(on)` that starts at 0 and moves only when the test moves it; advance it with `await clock.advance(1000)` to run due timers, and check effects like toasts after each advance. Status: Confirmed Entry: tool/claude-code/agents-and-automation/test-timer-drawing Revision: 1 Digest: sha256:26e3b8e9903fbefa (changes whenever the content changes) Timeline: Created: 2026-11-18T12:19:06Z Last changed: 2026-11-18T12:19:06Z Last verified: 2026-11-20T12:23:54Z Next check: 2026-11-21T12:23:54Z Check interval: Daily Expected change: No fixed schedule Data: Field | Value | Unit | Source | As of clock creation | mock.clock(on) | | [1] | 2026-11-20 advance method | await clock.advance(1000) | milliseconds | [1] | 2026-11-20 set method | await clock.set(5000) | | [1] | 2026-11-20 now method | clock.now() | | [1] | 2026-11-20 settle method | await clock.settle() | | [1] | 2026-11-20 sleep method | await clock.sleep(2000) | | [1] | 2026-11-20 custom start time | mock.clock(on, { now: 5000 }) | milliseconds | [1] | 2026-11-20 Sources: [1] Anthropic. "Test a mod". https://code.claude.com/docs/en/plugins/mods/test.md Role: primary. Accessed: 2026-11-20T12:23:54Z Quote: "`const clock = mock.clock(on)` returns a mock clock that starts at `0` and moves only when your test moves it." (Supports: clock creation) Quote: "`await clock.advance(1000)` | Moves the time forward by that many milliseconds and runs each timer that comes due" (Supports: advance method) Quote: "`await clock.set(5000)` | Moves the time forward to that value, as `advance` would" (Supports: set method) Quote: "`clock.now()` | Returns the time, which is what your mod's `$.clock.now()` resolves to" (Supports: now method) Quote: "`await clock.settle()` | Runs timers that are already due, such as a chain of zero-delay `$.clock.after` calls, without moving the time" (Supports: settle method) Quote: "`await clock.sleep(2000)` | Inside a stub, makes that stub answer only once the test has advanced that far, which is how you simulate a slow model or process" (Supports: sleep method) Quote: "To start at another time, pass it in milliseconds, as in `mock.clock(on, { now: 5000 })`." (Supports: custom start time) Published: 2026-11-20T03:41:00Z Snapshot SHA-256: ecd103b6b851eaaf887c3b26c34f4cfdb9d547bcbe6d8b2df147bd32c788bd5e (captured 2026-11-17T12:29:40Z) Verification: Method: Automated extraction from [1] with deepseek-flash (JSON output, thinking disabled). Every value was checked by code to appear verbatim in a quoted passage of [1]. On this check the text of [1] was unchanged since 2026-11-18T12:19:06Z, so the values verified then were kept. Cross-check: not-available at 2026-11-20T12:23:54Z. No independent second source is configured for this entry Last successful check: 2026-11-20T12:23:54Z Last attempt: 2026-11-20T12:23:54Z Notes and limitations: Extracted automatically from a single official source (section "Test a timer"). Related: https://latestn.com/tool/claude-code/agents-and-automation/tool-return-images-structured-data How do I return images or structured data from a Claude Code custom tool? https://latestn.com/tool/claude-code/agents-and-automation/user-input-limitations What are the limitations of handling user input with the Claude Code Agent SDK? https://latestn.com/tool/claude-code/agents-and-automation/wait-for-subagents How do I make Claude wait for subagents to finish before continuing? https://latestn.com/tool/claude-code/agents-and-automation/structured-output How do I get structured output from Claude Code programmatically? https://latestn.com/tool/claude-code/agents-and-automation/structured-output-quick-start How do I get validated JSON structured output from a Claude Code agent? https://latestn.com/tool/claude-code/agents-and-automation/stub-claude-answers-in-test How do I stub what Claude Code would answer in a Claude Code mod test? https://latestn.com/tool/ All entries in AI tools Change log: Time | Event | Change | Source 2026-11-18T12:19:06Z | added | Entry created | — Changes for this entry as a feed: https://latestn.com/tool/claude-code/agents-and-automation/test-timer-drawing/latest Challenge this entry: Open challenges: None How: If a value here is wrong or out of date, send what is wrong and a link to evidence. Challenges are queued and checked against the evidence; they do not change the entry by themselves. If the entry changes as a result, the change log says so. Form: https://latestn.com/dispute/tool/claude-code/agents-and-automation/test-timer-drawing POST: https://latestn.com/dispute/tool/claude-code/agents-and-automation/test-timer-drawing with claim, evidence_url, and optionally field and contact (form-encoded or JSON) GET: https://latestn.com/dispute/tool/claude-code/agents-and-automation/test-timer-drawing?claim={what is wrong}&evidence_url={link} How to cite: LatestN. (2026). How do I test a timer or a drawing in a Claude Code mod? Revision 1, last verified 2026-11-20T12:23:54Z. https://latestn.com/tool/claude-code/agents-and-automation/test-timer-drawing (accessed 2026-11-21T09:56:48Z). @misc{LatestN_tool_claude_code_agents_and_automation_test_timer_drawing_r1, title = {How do I test a timer or a drawing in a Claude Code mod?}, author = {{LatestN}}, year = {2026}, howpublished = {\url{https://latestn.com/tool/claude-code/agents-and-automation/test-timer-drawing}}, note = {Revision 1; digest sha256:26e3b8e9903fbefa; last verified 2026-11-20T12:23:54Z; accessed 2026-11-21T09:56:48Z} } Reuse: License: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/) Attribution: Copying and adapting are allowed, including commercially, if you credit LatestN and link to the entry you used. Each entry ends with a ready-made citation. URL: https://latestn.com/tool/claude-code/agents-and-automation/test-timer-drawing