(entries?: string[])
| 148 | } |
| 149 | |
| 150 | async function writeSessionLog(entries?: string[]): Promise<void> { |
| 151 | // Write the session log at the path share/index.ts will compute at runtime. |
| 152 | // We use the real state values (no mock) to match the actual path. |
| 153 | const { sanitizePath } = await import('../../../utils/path.js') |
| 154 | const { getSessionId, getOriginalCwd } = await import( |
| 155 | '../../../bootstrap/state.js' |
| 156 | ) |
| 157 | const sessionId = getSessionId() |
| 158 | const cwd = getOriginalCwd() |
| 159 | const encoded = sanitizePath(cwd) |
| 160 | const dir = join(claudeDir, 'projects', encoded) |
| 161 | mkdirSync(dir, { recursive: true }) |
| 162 | const content = entries ?? [ |
| 163 | JSON.stringify({ role: 'user', content: 'hello world' }), |
| 164 | JSON.stringify({ |
| 165 | role: 'assistant', |
| 166 | content: [{ type: 'text', text: 'hi there' }], |
| 167 | }), |
| 168 | ] |
| 169 | writeFileSync(join(dir, `${sessionId}.jsonl`), content.join('\n') + '\n') |
| 170 | } |
| 171 | |
| 172 | // Activate child_process stubs only for this suite. |
| 173 | beforeAll(() => { |
no test coverage detected