nx
nx copied to clipboard
No color output for individual Jest tests in GitLab after upgrade to Nx 14
Current Behavior
No colour output from Jest tests with the new Nx CLI formatting when running in GitLab.
Example command:
nx run-many --target=test --all --parallel=1
The message:
> NX Running target test for 50 project(s):
is in colour (it is a teal).
But the individual PASS/FAIL lines are not in colour.
I know that the local terminal output for run-many has been given a real makeover but this isn't used in the CI environment by default.
Expected Behavior
The individual PASS FAIL lines were in colour previously with no other changes except migrating from Nx 13 to Nx 14.
Before:

After:

Steps to Reproduce
Difficult to set up as it works fine locally via CLI as you'd expect, the terminal output is completely different now in the CLI (NX_TASKS_RUNNER_DYNAMIC_OUTPUT right) but in GitLab the output is similar to the old version.
tried:
FORCE_COLOR=true
--colors
--color
Environment
Local environment is as follows:
Node : 16.11.1
OS : darwin x64
npm : 8.0.0
nx : 14.3.6
@nrwl/angular : 14.3.6
@nrwl/cypress : 14.3.6
@nrwl/detox : Not Found
@nrwl/devkit : 14.3.6
@nrwl/eslint-plugin-nx : 14.3.6
@nrwl/express : Not Found
@nrwl/jest : 14.3.6
@nrwl/js : 14.3.6
@nrwl/linter : 14.3.6
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.3.6
@nrwl/web : 14.3.6
@nrwl/workspace : 14.3.6
typescript : 4.7.4
---------------------------------------
Community plugins:
@fortawesome/angular-fontawesome: 0.10.1
@ngrx/component-store: 13.2.0
@ngrx/effects: 13.2.0
@ngrx/entity: 13.2.0
@ngrx/router-store: 13.2.0
@ngrx/store: 13.2.0
rxjs: 6.6.7
@ngrx/schematics: 13.2.0
@ngrx/store-devtools: 13.2.0
for CI environment:
Node : 14.18.3
OS : linux x64
npm : 6.14.15
nx : 14.3.6
@nrwl/angular : 14.3.6
@nrwl/cypress : 14.3.6
@nrwl/detox : Not Found
@nrwl/devkit : 14.3.6
@nrwl/eslint-plugin-nx : 14.3.6
@nrwl/express : Not Found
@nrwl/jest : 14.3.6
@nrwl/js : 14.3.6
@nrwl/linter : 14.3.6
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.3.6
@nrwl/web : 14.3.6
@nrwl/workspace : 14.3.6
typescript : 4.7.4
---------------------------------------
Community plugins:
@fortawesome/angular-fontawesome: 0.10.1
@ngrx/component-store: 13.2.0
@ngrx/effects: 13.2.0
@ngrx/entity: 13.2.0
@ngrx/router-store: 13.2.0
@ngrx/store: 13.2.0
rxjs: 6.6.7
@ngrx/schematics: 13.2.0
@ngrx/store-devtools: 13.2.0
I'm having the exact same issue. Also, tried FORCE_COLOR=true but that seems ignored as well ):
can you try with --output-style=stream?
would be also interested what happens if you run with just jest cli and not via nx 🤔
Running through the jest cli also produces the same result of no color output. so unsure what I can fix in nrwl/jest. as with nx v13 and v14 were both running on jest v27
https://gitlab.com/caleb-ukle/testing-validation-bench/-/jobs/2829163380
do you have a GitLab repo that is showing the colors (or a previous commit I can check out?) so I can investigate further? but might be an issue worth raising on the Jest repo if it truly is a jest issue.
seems to be the same behavior as nx 13 🤔 what version of 13 were you on before going to v14? https://gitlab.com/caleb-ukle/nx-jest-colors/-/jobs/2829279451
This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs. If we missed this issue please reply to keep it active. Thanks for being a part of the Nx community! 🙏
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.