diff --git a/memory-bank/change-log.md b/memory-bank/change-log.md index 7f04cddd..3105e2b4 100644 --- a/memory-bank/change-log.md +++ b/memory-bank/change-log.md @@ -2175,3 +2175,29 @@ Validation: Follow-ups: - Optional next bounded slice: add this phase22 suite to any aggregate test runner used in CI if/when phase-level suites are centrally orchestrated. + +--- + +### CL-062: TASK22260 next slice — phase22 runner export guard parity (bounded test-harness consistency) + +date: 2026-03-25 +author: Cline +scope: `tests/phase22/core-token-behaviour.test.cjs` +type: change +rationale: Continue bounded test-hardening by aligning phase22 test entry behavior with established suite conventions so it can be executed both directly and from aggregate runners. +impact: Improves test harness composability and reduces accidental double-execution risk when importing phase22 test suites. +status: completed + +Summary: + +- Updated `tests/phase22/core-token-behaviour.test.cjs` to export `run` and add `require.main === module` guard. +- Preserved direct CLI execution behavior while enabling safe module import by aggregate runners. + +Validation: + +- `node tests/phase22/core-token-behaviour.test.cjs` -> pass (2/2) +- `npm run lint` -> warnings only (pre-existing `react-hooks/exhaustive-deps`; no new lint errors) + +Follow-ups: + +- Optional next bounded slice: add a dedicated `tests/phase22/index.test.cjs` aggregate entrypoint if additional phase22 suites are introduced. diff --git a/tests/phase22/core-token-behaviour.test.cjs b/tests/phase22/core-token-behaviour.test.cjs index 771918ef..2fefe54c 100644 --- a/tests/phase22/core-token-behaviour.test.cjs +++ b/tests/phase22/core-token-behaviour.test.cjs @@ -104,7 +104,11 @@ const run = async () => { ); }; -run().catch((error) => { - console.error(error); - process.exit(1); -}); +module.exports = run; + +if (require.main === module) { + run().catch((error) => { + console.error(error); + process.exit(1); + }); +}