diff --git a/src/agents/pi-embedded-runner.e2e.test.ts b/src/agents/pi-embedded-runner.e2e.test.ts index ca14c213f09..6ce2eb04b9c 100644 --- a/src/agents/pi-embedded-runner.e2e.test.ts +++ b/src/agents/pi-embedded-runner.e2e.test.ts @@ -248,10 +248,13 @@ const textFromContent = (content: unknown) => { const readSessionEntries = async (sessionFile: string) => { const raw = await fs.readFile(sessionFile, "utf-8"); - return raw - .split(/\r?\n/) - .filter(Boolean) - .map((line) => JSON.parse(line) as { type?: string; customType?: string; data?: unknown }); + const entries: Array<{ type?: string; customType?: string; data?: unknown }> = []; + for (const line of raw.split(/\r?\n/)) { + if (line.length > 0) { + entries.push(JSON.parse(line) as { type?: string; customType?: string; data?: unknown }); + } + } + return entries; }; const readSessionMessages = async (sessionFile: string) => {