diff --git a/tests/bug-2801-ingest-docs-handler.test.cjs b/tests/bug-2801-ingest-docs-handler.test.cjs index 4de0290b2..b06ccd605 100644 --- a/tests/bug-2801-ingest-docs-handler.test.cjs +++ b/tests/bug-2801-ingest-docs-handler.test.cjs @@ -105,7 +105,7 @@ describe('bug-2801: ingest-docs.md workflow calls gsd-tools not gsd-sdk', () => const content = fs.readFileSync(WORKFLOW_FILE, 'utf-8'); // Extract bash fenced code blocks structurally. const bashBlocks = []; - const codeBlockRe = /```bash\n([\s\S]*?)```/g; + const codeBlockRe = /```bash\r?\n([\s\S]*?)```/g; let m; while ((m = codeBlockRe.exec(content)) !== null) { bashBlocks.push(m[1]); @@ -129,7 +129,7 @@ describe('bug-2801: ingest-docs.md workflow calls gsd-tools not gsd-sdk', () => test('ingest-docs.md init step uses canonical node-path gsd-tools.cjs invocation', () => { const content = fs.readFileSync(WORKFLOW_FILE, 'utf-8'); // Parse fenced bash blocks structurally — do not match raw markdown text. - const codeBlockRe = /```bash\n([\s\S]*?)```/g; + const codeBlockRe = /```bash\r?\n([\s\S]*?)```/g; const bashLines = [...content.matchAll(codeBlockRe)] .flatMap((m) => m[1].split('\n')) .filter((l) => !/^\s*#/.test(l)); diff --git a/tests/bug-3072-optional-sketch-findings-guard.test.cjs b/tests/bug-3072-optional-sketch-findings-guard.test.cjs index c22e603d6..50dc1d2f1 100644 --- a/tests/bug-3072-optional-sketch-findings-guard.test.cjs +++ b/tests/bug-3072-optional-sketch-findings-guard.test.cjs @@ -13,13 +13,13 @@ function read(rel) { function extractFindingsProbesFromBashBlocks(markdown) { const probes = []; - const fenceRe = /```bash\n([\s\S]*?)```/g; + const fenceRe = /```bash\r?\n([\s\S]*?)```/g; let fenceMatch; while ((fenceMatch = fenceRe.exec(markdown)) !== null) { const block = fenceMatch[1]; - const baseLine = markdown.slice(0, fenceMatch.index).split('\n').length; - const lines = block.split('\n'); + const baseLine = markdown.slice(0, fenceMatch.index).split(/\r?\n/).length; + const lines = block.split(/\r?\n/); lines.forEach((line, idx) => { if (!line.includes('.claude/skills/')) return; diff --git a/tests/bug-3321-verifier-runs-probes.test.cjs b/tests/bug-3321-verifier-runs-probes.test.cjs index 8caf8be6b..6af5e4ff2 100644 --- a/tests/bug-3321-verifier-runs-probes.test.cjs +++ b/tests/bug-3321-verifier-runs-probes.test.cjs @@ -15,7 +15,7 @@ function verifierProbeContract(content) { assert.notEqual(sectionEnd, -1, 'verifier must close Step 7c before Step 8'); const section = content.slice(sectionStart, sectionEnd); - const codeBlocks = [...section.matchAll(/```bash\n([\s\S]*?)\n```/g)].map((match) => match[1]); + const codeBlocks = [...section.matchAll(/```bash\r?\n([\s\S]*?)\r?\n```/g)].map((match) => match[1].split(/\r?\n/).join('\n')); const executionSteps = [...section.matchAll(/^\d+\.\s+(.+)$/gm)].map((match) => match[1]); return { title: 'Step 7c: Probe Execution',