ECC/tests/ci
Johnson K C 40673a89fa
test: guard broken-symlink tests so the suite passes on Windows (#2176)
* test: guard broken-symlink tests so the suite passes on Windows

Four test cases create a dangling symlink with fs.symlinkSync() to exercise
statSync catch branches, but did not guard for platforms where symlink
creation is not permitted. On Windows without Developer Mode / admin rights,
fs.symlinkSync throws EPERM, so these tests fail and `npm test` is red:

  - tests/ci/validators.test.js (Round 73, validate-commands skill entry)
  - tests/lib/session-manager.test.js (Round 83, getAllSessions)
  - tests/lib/session-manager.test.js (Round 84, getSessionById)
  - tests/lib/utils.test.js (Round 84, findFiles)

Wrap each symlinkSync in try/catch and skip cleanly on failure, mirroring the
existing convention already used in this repo (validators.test.js Round 57 and
hooks/config-protection.test.js). On Linux/macOS and admin Windows the symlink
still succeeds and the tests run unchanged; only the unsupported-symlink path
now skips instead of failing.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* test: only skip symlink tests on EPERM/EACCES, rethrow other errors

Address CodeRabbit review: the catch blocks swallowed every error, which could
mask a real test/setup failure as a false skip. Inspect err.code and only take
the skip path for EPERM/EACCES (symlink creation blocked, e.g. Windows without
Developer Mode); rethrow anything else so genuine failures still surface.

Per the repo coding guideline: never silently swallow errors.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 13:25:43 +08:00
..
agent-instruction-safety.test.js test: report instruction guardrails independently 2026-04-30 09:39:54 -04:00
agent-yaml-surface.test.js fix: remove canonical Anthropic skill duplicates 2026-04-30 00:21:13 -04:00
catalog.test.js feat: add command registry and coverage checks (#1906) 2026-05-14 22:02:36 -04:00
code-reviewer-false-positive-guard.test.js feat: salvage code-reviewer false-positive guardrails (#1817) 2026-05-12 15:01:46 -04:00
codex-skill-surface.test.js feat: add machine learning engineering workflow 2026-05-11 17:55:50 -04:00
command-registry.test.js feat: add command registry and coverage checks (#1906) 2026-05-14 22:02:36 -04:00
dynamic-workflow-team-surface.test.js feat: add dynamic workflow team orchestration surface 2026-06-04 21:45:13 +08:00
mle-workflow-coverage.test.js feat: add machine learning engineering workflow 2026-05-11 17:55:50 -04:00
no-personal-paths.test.js fix: harden CI validators 2026-05-11 03:08:43 -04:00
scan-supply-chain-iocs.test.js fix: ignore defensive ioc deny rules 2026-05-18 02:29:59 -04:00
supply-chain-advisory-sources.test.js Cover advisory source renderer branches 2026-05-15 23:09:54 -04:00
supply-chain-watch-workflow.test.js Add supply-chain advisory source refresh 2026-05-15 23:09:54 -04:00
validate-workflow-security.test.js security: scope release oidc publishing 2026-05-18 13:41:10 -04:00
validators.test.js test: guard broken-symlink tests so the suite passes on Windows (#2176) 2026-06-07 13:25:43 +08:00