test: enable skipped colorize test

PR-URL: https://github.com/nodejs/node/pull/57887
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
This commit is contained in:
Shima Ryuhei 2025-04-18 20:08:00 +09:00 committed by GitHub
parent 963b24e9a6
commit 6cdcaa9653
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 5 deletions

View File

@ -20,7 +20,7 @@
output | [31m [34m | [31m [34m | [31m [34m |
[32mcoverage-width-80-color.mjs [34m | [32m100.00[34m | [32m 100.00[34m | [32m 100.00[34m |
------------------------------------------------------------------------------
all files | [33m 61.33[34m | [32m 100.00[34m | [31m 0.00[34m |
all files | [33m 62.34[34m | [32m 100.00[34m | [31m 0.00[34m |
------------------------------------------------------------------------------
end of coverage report
[39m

View File

@ -21,7 +21,7 @@
output | [31m [34m | [31m [34m | [31m [34m |
[32mcoverage-width-80-uncovered-lines-color.mjs [34m | [32m100.00[34m | [32m 100.00[34m | [32m 100.00[34m |
--------------------------------------------------------------------------------------------------
all files | [33m 52.91[34m | [33m 60.00[34m | [31m 1.61[34m |
all files | [33m 53.24[34m | [33m 60.00[34m | [31m 1.61[34m |
--------------------------------------------------------------------------------------------------
end of coverage report
[39m

View File

@ -1,3 +1,4 @@
// Flags: --expose-internals
import * as common from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import * as snapshot from '../common/assertSnapshot.js';
@ -5,14 +6,13 @@ import { describe, it } from 'node:test';
import { hostname } from 'node:os';
import { chdir, cwd } from 'node:process';
import { fileURLToPath } from 'node:url';
import internalTTy from 'internal/tty';
const skipForceColors =
process.config.variables.icu_gyp_path !== 'tools/icu/icu-generic.gyp' ||
process.config.variables.node_shared_openssl;
const canColorize = process.stderr?.isTTY && (
typeof process.stderr?.getColorDepth === 'function' ?
process.stderr?.getColorDepth() > 2 : true);
const canColorize = internalTTy.getColorDepth() > 2;
const skipCoverageColors = !canColorize;
function replaceTestDuration(str) {