Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(tests): source pins read the same bytes on a CRLF checkout

purple01cd13c7a4ed
diff --git a/src/hooks/__tests__/agent-think-downgrade.test.ts b/src/hooks/__tests__/agent-think-downgrade.test.ts
index cd12bc0d..a8dc9c70 100644
--- a/src/hooks/__tests__/agent-think-downgrade.test.ts
+++ b/src/hooks/__tests__/agent-think-downgrade.test.ts
@@ -15,9 +15,11 @@ import { readFileSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
+// Normalize to LF: a Windows checkout with core.autocrlf=true materializes
+// CRLF, and the multi-line pins below would fail on line endings alone.
const src = readFileSync(
resolve(dirname(fileURLToPath(import.meta.url)), '../useAgentChat.ts'), 'utf8',
-)
+).replace(/\r\n/g, '\n')
describe('both branches check before they resend', () => {
it('the ollama branch guards on the value it would drop', () => {
diff --git a/src/hooks/__tests__/benchmark-stop-and-errors.test.ts b/src/hooks/__tests__/benchmark-stop-and-errors.test.ts
index 09ac5f1a..504bee63 100644
--- a/src/hooks/__tests__/benchmark-stop-and-errors.test.ts
+++ b/src/hooks/__tests__/benchmark-stop-and-errors.test.ts
@@ -23,9 +23,12 @@ import { toMarkdownReport } from '../../stores/benchmarkStore'
import type { BenchmarkResult } from '../../lib/benchmark-prompts'
const here = dirname(fileURLToPath(import.meta.url))
-const hook = readFileSync(resolve(here, '../useBenchmark.ts'), 'utf8')
-const store = readFileSync(resolve(here, '../../stores/benchmarkStore.ts'), 'utf8')
-const view = readFileSync(resolve(here, '../../components/models/BenchmarkView.tsx'), 'utf8')
+// Normalize to LF: a Windows checkout with core.autocrlf=true materializes
+// CRLF, and pins that span a line break would fail on line endings alone.
+const lf = (p: string) => readFileSync(resolve(here, p), 'utf8').replace(/\r\n/g, '\n')
+const hook = lf('../useBenchmark.ts')
+const store = lf('../../stores/benchmarkStore.ts')
+const view = lf('../../components/models/BenchmarkView.tsx')
describe('stop reaches the loop, not just the request', () => {
it('the loop checks the stop flag before every prompt', () => {
diff --git a/src/lib/__tests__/thinking-chronology.test.ts b/src/lib/__tests__/thinking-chronology.test.ts
index fcb461e9..89782682 100644
--- a/src/lib/__tests__/thinking-chronology.test.ts
+++ b/src/lib/__tests__/thinking-chronology.test.ts
@@ -15,7 +15,9 @@ import { fileURLToPath } from 'node:url'
import { dirname, resolve } from 'node:path'
const here = dirname(fileURLToPath(import.meta.url))
-const read = (rel: string) => readFileSync(resolve(here, rel), 'utf8')
+// Normalize to LF: a Windows checkout with core.autocrlf=true materializes
+// CRLF, and pins that span a line break would fail on line endings alone.
+const read = (rel: string) => readFileSync(resolve(here, rel), 'utf8').replace(/\r\n/g, '\n')
const agent = read('../../hooks/useAgentChat.ts')
const bubble = read('../../components/chat/MessageBubble.tsx')