diff --git a/tests/lib/opencode-consent-legacy-lock.test.js b/tests/lib/opencode-consent-legacy-lock.test.js index 4e65cc9e4..60b382af7 100644 --- a/tests/lib/opencode-consent-legacy-lock.test.js +++ b/tests/lib/opencode-consent-legacy-lock.test.js @@ -238,7 +238,8 @@ function runTests() { if (unrelated === 'file') fs.writeFileSync(value.legacyRoot, 'user file'); else if (unrelated === 'symlink') { fs.mkdirSync(value.canonicalRoot, { recursive: true }); - fs.symlinkSync(value.canonicalRoot, value.legacyRoot, process.platform === 'win32' ? 'junction' : 'dir'); + if (!trySymlink(value.canonicalRoot, value.legacyRoot, + process.platform === 'win32' ? 'junction' : 'dir')) return; } else { fs.mkdirSync(value.legacyRoot, { recursive: true }); if (unrelated === 'malformed-state') fs.writeFileSync(value.legacyStatePath, '{malformed'); diff --git a/tests/scripts/coordination-inventory.test.js b/tests/scripts/coordination-inventory.test.js index 5dfd152ce..87239b96a 100644 --- a/tests/scripts/coordination-inventory.test.js +++ b/tests/scripts/coordination-inventory.test.js @@ -88,7 +88,8 @@ test('task file adapter reads structured status, labels mtime, skips symlinks an const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'coordination-test-')); try { fs.mkdirSync(path.join(dir, 'worker')); fs.writeFileSync(path.join(dir, 'worker', 'STATUS.md'), '- State: running\n- Updated: 2026-09-08T06:29:00Z\n'); - if (!trySymlink(path.join(dir, 'worker'), path.join(dir, 'linked'))) return; + // The task count holds with or without the link, so a refusal must not skip the rest. + trySymlink(path.join(dir, 'worker'), path.join(dir, 'linked')); const r = collectTaskFiles(dir); assert.equal(r.tasks.length, 1); assert.equal(r.tasks[0].status, 'running'); assert.ok(r.tasks[0].statusFileModifiedAt); assert.equal(r.tasks[0].heartbeatAt, '2026-09-08T06:29:00Z'); fs.writeFileSync(path.join(dir, 'large.json'), ' '.repeat(1024 * 1024 + 1)); diff --git a/tests/skills/frontend-design-direction.test.js b/tests/skills/frontend-design-direction.test.js index aa95a8094..e46ef3dec 100644 --- a/tests/skills/frontend-design-direction.test.js +++ b/tests/skills/frontend-design-direction.test.js @@ -119,11 +119,14 @@ test('CLI requires a nonempty local artifact and fails safely on invalid input', assert.equal(run(input).status, 1, 'empty artifact must fail'); fs.writeFileSync(path.join(dir, 'render.png'), 'nonempty local artifact'); fs.writeFileSync(path.join(external, 'render.png'), 'nonempty external artifact'); - if (!trySymlink(path.join(dir, 'render.png'), path.join(dir, 'linked.png'))) return; - if (!trySymlink(path.join(external, 'render.png'), path.join(dir, 'outside'))) return; - fs.symlinkSync(external, path.join(dir, 'external-dir'), 'junction'); - for (const artifact of ['.', 'https://example.com/render.png', path.join(dir, 'render.png'), - '../render.png', 'C:\\render.png', 'linked.png', 'outside', 'external-dir/render.png']) { + // Add the link-based cases only where the OS allows the link, so a refusal + // narrows this list instead of skipping the gate and input checks below. + const artifacts = ['.', 'https://example.com/render.png', path.join(dir, 'render.png'), + '../render.png', 'C:\\render.png']; + if (trySymlink(path.join(dir, 'render.png'), path.join(dir, 'linked.png'))) artifacts.push('linked.png'); + if (trySymlink(path.join(external, 'render.png'), path.join(dir, 'outside'))) artifacts.push('outside'); + if (trySymlink(external, path.join(dir, 'external-dir'), 'junction')) artifacts.push('external-dir/render.png'); + for (const artifact of artifacts) { fs.writeFileSync(input, JSON.stringify({ ...report(), renderedEvidence: [{ viewport: '390x844', artifact, observation: 'Checked.' }] })); assert.equal(run(input).status, 1, 'directories and remote artifacts must fail'); }