node icon indicating copy to clipboard operation
node copied to clipboard

lib: ensure FORCE_COLOR forces color output in non-TTY environments

Open pmarchini opened this issue 1 year ago β€’ 14 comments

This PR should address #55383.

pmarchini avatar Oct 16 '24 12:10 pmarchini

Review requested:

  • [ ] @nodejs/test_runner

nodejs-github-bot avatar Oct 16 '24 12:10 nodejs-github-bot

The subsystem here shouldn't be test, it should be lib

avivkeller avatar Oct 16 '24 12:10 avivkeller

Thanks @RedYetiDev, I was not sure about this, gonna change it!

pmarchini avatar Oct 16 '24 12:10 pmarchini

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 88.41%. Comparing base (b0ffe9e) to head (dd82e49). Report is 1425 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #55404      +/-   ##
==========================================
- Coverage   88.42%   88.41%   -0.01%     
==========================================
  Files         653      653              
  Lines      187498   187496       -2     
  Branches    36100    36103       +3     
==========================================
- Hits       165791   165783       -8     
- Misses      14957    14960       +3     
- Partials     6750     6753       +3     
Files with missing lines Coverage Ξ”
lib/internal/util/colors.js 100.00% <100.00%> (ΓΈ)

... and 24 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Oct 16 '24 14:10 codecov[bot]

Fixes #55383 Fixes #52249

avivkeller avatar Oct 16 '24 15:10 avivkeller

CI: https://ci.nodejs.org/job/node-test-pull-request/63147/

nodejs-github-bot avatar Oct 16 '24 20:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63148/

nodejs-github-bot avatar Oct 16 '24 21:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63154/

nodejs-github-bot avatar Oct 17 '24 06:10 nodejs-github-bot

Fixes #55383 Fixes #52249

Regarding #52249, I would say we have two ways to ensure the fix:

  1. Add a test in this PR to confirm that the issue is indeed resolved.
  2. After this PR gets merged, open another PR with a test to ensure the fix and close the issue.

Given https://github.com/nodejs/node/blob/e2242b4e256082e01d8df6a4155ddc80e146c123/lib/internal/test_runner/harness.js#L66-L69 I believe this PR should resolve both issues, as you suggest 😁.

Personally, I would go with option 1.

WDYT @RedYetiDev @cjihrig

pmarchini avatar Oct 17 '24 09:10 pmarchini

I'd go with 1

avivkeller avatar Oct 17 '24 10:10 avivkeller

Option 1 sounds good.

cjihrig avatar Oct 17 '24 13:10 cjihrig

While working on the tests I've seen this behaviour: image This comes from this recently merged PR #54862.

import assert from 'node:assert/strict'
import { test } from 'node:test'

test('failing assertion', () => {
  assert.strictEqual('apple', 'pear')
})

results in: image

Honestly I've mixed feelings about this from a devEx pov.

@nodejs/test_runner @nodejs/assert

pmarchini avatar Oct 17 '24 21:10 pmarchini

Failed to start CI
   ⚠  Something was pushed to the Pull Request branch since the last approving review.
   ✘  Refusing to run CI on potentially unsafe PR
https://github.com/nodejs/node/actions/runs/11397893999

github-actions[bot] avatar Oct 18 '24 05:10 github-actions[bot]

CI: https://ci.nodejs.org/job/node-test-pull-request/63179/

nodejs-github-bot avatar Oct 18 '24 12:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63228/

nodejs-github-bot avatar Oct 21 '24 08:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63229/

nodejs-github-bot avatar Oct 21 '24 10:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63235/

nodejs-github-bot avatar Oct 21 '24 16:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63239/

nodejs-github-bot avatar Oct 21 '24 17:10 nodejs-github-bot

CI: https://ci.nodejs.org/job/node-test-pull-request/63243/

nodejs-github-bot avatar Oct 21 '24 22:10 nodejs-github-bot

Landed in 025d8ada5fffb109e8f66c7d1bcf0c2e90a1383c

nodejs-github-bot avatar Oct 23 '24 06:10 nodejs-github-bot

This commit does land cleanly on v22.x-staging but make tests fail and will need manual backport in case we want it in v22.x.

ruyadorno avatar Nov 27 '24 16:11 ruyadorno