[Bug] Test suite has contradictory colour expectations: CI and local fail in different specs
Description
The test suite disagrees with itself about whether ANSI colour is enabled, so it fails in different places depending on where it runs. Chalk enables colour under GitHub Actions (CI / GITHUB_ACTIONS are set) and disables it in a plain local shell.
- Specs that assume colour is off:
source/components/ui/styled-select-input.spec.tsxanchors regexes to the raw frame (/^>\s+First option/). With colour on the line begins with an ANSI escape, so the^>anchor never matches. Red in CI, green locally. - Specs that assume colour is on:
source/app/components/settings-tabs.spec.tsxasserts ANSI codes are present (inverse-video/\x1b\[7m/, border colour codes). Green in CI, red locally.
The result is that neither environment gives a trustworthy signal, and contributors cannot tell their own failures apart from pre-existing ones.
Environment
- OS: Windows 11 the diagnosis is environment-independent, it depends only on whether chalk emits escape codes
- Node version: v22.22.3
- Nanocoder version:
main@ 0d9206cf - Provider: n/a (test suite only)
- Model: n/a
Steps to Reproduce
- On
main, runnpx ava source/components/ui/styled-select-input.spec.tsx4 tests pass. - Run
FORCE_COLOR=1 npx ava source/components/ui/styled-select-input.spec.tsx3 tests fail, identical to CI. - Run
FORCE_COLOR=0 npx ava source/app/components/settings-tabs.spec.tsxthe ANSI-dependent assertions fail instead.
Expected Behavior
Colour behaviour is pinned explicitly so the suite gives the same result locally and in CI, and frame assertions follow a single convention.
Actual Behavior
Colour is left to chalk's auto-detection, so the same commit produces different failures in CI than in a local shell.
Logs/Screenshots
The CI failure is confusing to read, because the expected and actual look identical the escape is invisible:
Value must match expression:
'> FIRST OPTION' <- actually '\x1b[34m>\x1b[39m FIRST OPTION'
Regular expression:
/^>\s+FIRST OPTION/
This reproduces on unrelated PRs too, e.g. https://github.com/Nano-Collective/nanocoder/actions/runs/31484127828
Suggested Fix
Pin FORCE_COLOR in the AVA config in package.json and settle on one convention for frame assertions.
Note that simply setting FORCE_COLOR=0 globally would break settings-tabs.spec.tsx, so the ANSI-dependent specs need updating in the same pass.
A narrow fix for the three styled-select-input failures alone stripping ANSI before asserting, matching the existing pattern in markdown-parser/index.spec.ts and user-input.spec.tsx is in a separate PR. It unblocks CI but does not address the underlying inconsistency.
Separately: a flaky test
components > user-input > UserInput reports and restores submitted drafts with attachments is nondeterministic. On identical code it failed in run 31492854852 and passed in run 31493697316.
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder