Skip to content

Commit 222e4b5

Browse files
committed
test(memory-leak): assert cwd from bash metadata on windows
1 parent a31b2c1 commit 222e4b5

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

src/tests/memory-leak.test.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,15 @@ test("Deleted session id reuse should reset bash cwd to project root", async ()
173173
assert.equal(second.ok, true);
174174

175175
const output = (second.output ?? "").trim();
176+
const metadataCwd =
177+
second.metadata && typeof second.metadata.cwd === "string" ? (second.metadata.cwd as string) : null;
176178
const normalizedRoot = fs.realpathSync(projectRoot);
177179
const normalizedOutput =
178-
process.platform === "win32" && output.startsWith("/") ? posixPathToWindowsPath(output) : output;
179-
assert.ok(normalizedOutput.startsWith(normalizedRoot), `expected cwd to reset to ${normalizedRoot}, got ${output}`);
180+
metadataCwd ?? (process.platform === "win32" && output.startsWith("/") ? posixPathToWindowsPath(output) : output);
181+
assert.ok(
182+
normalizedOutput.startsWith(normalizedRoot),
183+
`expected cwd to reset to ${normalizedRoot}, got output=${output}, metadata.cwd=${String(metadataCwd)}`
184+
);
180185
});
181186

182187
test("deleteSession should not kill untracked stale persisted pids", async () => {

0 commit comments

Comments
 (0)