spacehub

surshar / claude-code

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

Built by Anthropic · github.com/anthropics

claude-code / mods / diff / tests / fixtures / starts-session.ts
17 lines · 585 BRaw
1import type { On } from 'claude-code'
2import { mock } from 'claude-code/testing'
3import type { MockClock } from 'claude-code/testing'
4
5/**
6 * Answers what every /diff session asks first: its start, with its own
7 * directory, the time, and each command it registers, under its name.
8 *
9 * @param on the test's `on`
10 * @returns the clock the session reads, at 0 until the test moves it
11 */
12export function startsSession(on: On): MockClock {
13 on('session.start', ($, e) => ({ cwd: e.cwd }))
14 on('command.register', ($, e) => ({ value: { command: e.name } }))
15
16 return mock.clock(on)
17}