Skip to content
This repository was archived by the owner on Feb 14, 2026. It is now read-only.

Commit 0af1172

Browse files
bra1nDumpclaude
andcommitted
fix(test): use getProjectPath in sessionScanner test for consistent path calculation
The test was failing because it manually calculated the project directory path by only replacing `/` with `-`, while getProjectPath replaces additional characters including underscores. On macOS, temp directory paths contain underscores, causing a path mismatch. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 6bebc6b commit 0af1172

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/claude/utils/sessionScanner.test.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@ import { createSessionScanner } from './sessionScanner'
33
import { RawJSONLines } from '../types'
44
import { mkdir, writeFile, appendFile, rm, readFile } from 'node:fs/promises'
55
import { join } from 'node:path'
6-
import { tmpdir, homedir } from 'node:os'
6+
import { tmpdir } from 'node:os'
77
import { existsSync } from 'node:fs'
8+
import { getProjectPath } from './path'
89

910
describe('sessionScanner', () => {
1011
let testDir: string
@@ -15,11 +16,11 @@ describe('sessionScanner', () => {
1516
beforeEach(async () => {
1617
testDir = join(tmpdir(), `scanner-test-${Date.now()}`)
1718
await mkdir(testDir, { recursive: true })
18-
19-
const projectName = testDir.replace(/\//g, '-')
20-
projectDir = join(homedir(), '.claude', 'projects', projectName)
19+
20+
// Use the same path calculation as the scanner to ensure paths match
21+
projectDir = getProjectPath(testDir)
2122
await mkdir(projectDir, { recursive: true })
22-
23+
2324
collectedMessages = []
2425
})
2526

0 commit comments

Comments
 (0)