Skip to content

No colors in GitLab CI job output by default #4401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
MurzNN opened this issue Apr 2, 2025 · 3 comments
Open

No colors in GitLab CI job output by default #4401

MurzNN opened this issue Apr 2, 2025 · 3 comments

Comments

@MurzNN
Copy link

MurzNN commented Apr 2, 2025

Description of the bug/issue

When I run Nightwatch.js in GitLab CI, the colored output disappears. But it works when I run the same tests locally.

Steps to reproduce

  1. Run a Nightwatch test in GitLab CI.
  2. See no colors.

Nightwatch.js Version

3.12.1

Node Version

22.0

Browser

GitLab CI

Operating System

Linux

Additional Information

Found a working workaround by setting the FORCE_COLOR=1 environment variable. But it's better to make this work by default.

@fjgarlin
Copy link

fjgarlin commented Apr 2, 2025

I can confirm that the fix works.

The only change was to add that variable to our CI job: https://git.drupalcode.org/project/gitlab_templates/-/merge_requests/342/diffs

@garg3133
Copy link
Member

garg3133 commented Apr 24, 2025

We use the chalk package for providing colours, which internally detects whether a terminal supports colours or not.

So, it seems that the tool used by chalk to detect colour support (supports-color) does not have support for GitLab CI.

Edit: It actually checks for CI and GITLAB_CI in env variables to decide whether to enable colors or not: https://github.com/chrispat/supports-color/blob/416db16110d450eb5b5d559840468a67821594a1/index.js#L84

@fjgarlin
Copy link

The above projects do have both CI and GITLAB_CI env variables and they are set to true.
https://git.drupalcode.org/project/gitlab_templates_downstream/-/jobs/4846185#L52 and
https://git.drupalcode.org/project/gitlab_templates_downstream/-/jobs/4846185#L249

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

No branches or pull requests

3 participants