Skip to content

test: set NO_COLOR in mocha-bootstrap to match CI - #11303

Open
ajperel wants to merge 1 commit into
mainfrom
ajp/fix_test_failures_ansi_colors
Open

ajperel wants to merge 1 commit into
mainfrom
ajp/fix_test_failures_ansi_colors

Conversation

@ajperel

@ajperel ajperel commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Description

GitHub Actions CI sets NO_COLOR: true in .github/workflows/node-test.yml, while local interactive terminals satisfy colorette v2's load-time tty.isatty(1) check and wrap bold(...) strings in ANSI escape codes. This mismatch caused five unit tests across hosting:clone, login, and ext:migrate to pass in CI but fail locally.

Set process.env.NO_COLOR = "true" at the top of src/test/helpers/mocha-bootstrap.js. Because Mocha loads mocha-bootstrap.js before global-mock-auth.ts (which first imports colorette), local npm test and npx mocha runs now match CI while keeping Mocha's own colored test output intact.

Scenarios Tested

  • Ran the three spec files that were previously failing only locally (hosting-clone.spec.ts, login.spec.ts, and migrate.spec.ts) in an interactive TTY (53 passing).
  • Ran the full unit test suite (npm run mocha:fast) in an interactive TTY (5,879 passing).
  • Ran npm run lint:changed-files.

Sample Commands

N/A

### Description
GitHub Actions CI sets `NO_COLOR: true` in `.github/workflows/node-test.yml`, while local interactive terminals satisfy `colorette` v2's load-time `tty.isatty(1)` check and wrap `bold(...)` strings in ANSI escape codes. This mismatch caused five unit tests across `hosting:clone`, `login`, and `ext:migrate` to pass in CI but fail locally.

Set `process.env.NO_COLOR = "true"` at the top of `src/test/helpers/mocha-bootstrap.js`. Because Mocha loads `mocha-bootstrap.js` before `global-mock-auth.ts` (which first imports `colorette`), local `npm test` and `npx mocha` runs now match CI while keeping Mocha's own colored test output intact.

### Scenarios Tested
- Ran the three spec files that were previously failing only locally (`hosting-clone.spec.ts`, `login.spec.ts`, and `migrate.spec.ts`) in an interactive TTY (`53 passing`).
- Ran the full unit test suite (`npm run mocha:fast`) in an interactive TTY (`5,879 passing`).
- Ran `npm run lint:changed-files`.

### Sample Commands
N/A

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Mocha bootstrap helper to set the NO_COLOR environment variable to "true". This ensures that colorette does not emit ANSI color codes during local TTY test runs, aligning local test execution with the CI environment. There are no review comments, so I have no feedback to provide.

@ajperel
ajperel requested a review from joehan October 17, 2026 05:05

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant