lib: ensure FORCE_COLOR forces color output in non-TTY environments
This PR should address #55383.
Review requested:
- [ ] @nodejs/test_runner
The subsystem here shouldn't be test, it should be lib
Thanks @RedYetiDev, I was not sure about this, gonna change it!
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%> (ΓΈ) |
: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.
Fixes #55383 Fixes #52249
CI: https://ci.nodejs.org/job/node-test-pull-request/63147/
CI: https://ci.nodejs.org/job/node-test-pull-request/63148/
CI: https://ci.nodejs.org/job/node-test-pull-request/63154/
Fixes #55383 Fixes #52249
Regarding #52249, I would say we have two ways to ensure the fix:
- Add a test in this PR to confirm that the issue is indeed resolved.
- 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
I'd go with 1
Option 1 sounds good.
While working on the tests I've seen this behaviour:
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:
Honestly I've mixed feelings about this from a devEx pov.
@nodejs/test_runner @nodejs/assert
Failed to start CI
β Something was pushed to the Pull Request branch since the last approving review. β Refusing to run CI on potentially unsafe PRhttps://github.com/nodejs/node/actions/runs/11397893999
CI: https://ci.nodejs.org/job/node-test-pull-request/63179/
CI: https://ci.nodejs.org/job/node-test-pull-request/63228/
CI: https://ci.nodejs.org/job/node-test-pull-request/63229/
CI: https://ci.nodejs.org/job/node-test-pull-request/63235/
CI: https://ci.nodejs.org/job/node-test-pull-request/63239/
CI: https://ci.nodejs.org/job/node-test-pull-request/63243/
Landed in 025d8ada5fffb109e8f66c7d1bcf0c2e90a1383c
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.