nx icon indicating copy to clipboard operation
nx copied to clipboard

No color output for individual Jest tests in GitLab after upgrade to Nx 14

Open adam-marshall opened this issue 3 years ago • 5 comments
trafficstars

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: Screenshot 2022-06-27 at 15 49 15

After: Screenshot 2022-06-27 at 15 47 33

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

adam-marshall avatar Jun 27 '22 15:06 adam-marshall

I'm having the exact same issue. Also, tried FORCE_COLOR=true but that seems ignored as well ):

alfaproject avatar Jul 23 '22 03:07 alfaproject

can you try with --output-style=stream?

barbados-clemens avatar Aug 02 '22 14:08 barbados-clemens

would be also interested what happens if you run with just jest cli and not via nx 🤔

barbados-clemens avatar Aug 03 '22 14:08 barbados-clemens

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.

barbados-clemens avatar Aug 08 '22 19:08 barbados-clemens

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

barbados-clemens avatar Aug 08 '22 19:08 barbados-clemens

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! 🙏

github-actions[bot] avatar Aug 23 '22 00:08 github-actions[bot]

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.

github-actions[bot] avatar Mar 21 '23 23:03 github-actions[bot]