forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
lib: ensure FORCE_COLOR forces color output in non-TTY environments
PR-URL: nodejs#55404 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Jake Yuesong Li <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Moshe Atlow <[email protected]> Reviewed-By: James M Snell <[email protected]>
- Loading branch information
Showing
6 changed files
with
78 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import assert from 'node:assert/strict' | ||
import { test } from 'node:test' | ||
|
||
test('failing assertion', () => { | ||
assert.strictEqual('!Hello World', 'Hello World!') | ||
}) |
37 changes: 37 additions & 0 deletions
37
test/fixtures/test-runner/output/assertion-color-tty.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[31m✖ failing assertion [90m(*ms)[39m[39m | ||
[AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: | ||
[32mactual[39m [31mexpected[39m | ||
|
||
[39m'[39m[32m![39m[39mH[39m[39me[39m[39ml[39m[39ml[39m[39mo[39m[39m [39m[39mW[39m[39mo[39m[39mr[39m[39ml[39m[39md[39m[31m![39m[39m'[39m | ||
] { | ||
generatedMessage: [33mtrue[39m, | ||
code: [32m'ERR_ASSERTION'[39m, | ||
actual: [32m'!Hello World'[39m, | ||
expected: [32m'Hello World!'[39m, | ||
operator: [32m'strictEqual'[39m | ||
} | ||
|
||
[34mℹ tests 1[39m | ||
[34mℹ suites 0[39m | ||
[34mℹ pass 0[39m | ||
[34mℹ fail 1[39m | ||
[34mℹ cancelled 0[39m | ||
[34mℹ skipped 0[39m | ||
[34mℹ todo 0[39m | ||
[34mℹ duration_ms *[39m | ||
|
||
[31m✖ failing tests:[39m | ||
|
||
* | ||
[31m✖ failing assertion [90m(*ms)[39m[39m | ||
[AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: | ||
[32mactual[39m [31mexpected[39m | ||
|
||
[39m'[39m[32m![39m[39mH[39m[39me[39m[39ml[39m[39ml[39m[39mo[39m[39m [39m[39mW[39m[39mo[39m[39mr[39m[39ml[39m[39md[39m[31m![39m[39m'[39m | ||
] { | ||
generatedMessage: [33mtrue[39m, | ||
code: [32m'ERR_ASSERTION'[39m, | ||
actual: [32m'!Hello World'[39m, | ||
expected: [32m'Hello World!'[39m, | ||
operator: [32m'strictEqual'[39m | ||
} |
6 changes: 6 additions & 0 deletions
6
test/fixtures/test-runner/output/non-tty-forced-color-output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
process.env.FORCE_COLOR = 1; | ||
|
||
const test = require('node:test'); | ||
test('passing test', () => {}); |
9 changes: 9 additions & 0 deletions
9
test/fixtures/test-runner/output/non-tty-forced-color-output.snapshot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
[32m✔ passing test [90m(*ms)[39m[39m | ||
[34mℹ tests 1[39m | ||
[34mℹ suites 0[39m | ||
[34mℹ pass 1[39m | ||
[34mℹ fail 0[39m | ||
[34mℹ cancelled 0[39m | ||
[34mℹ skipped 0[39m | ||
[34mℹ todo 0[39m | ||
[34mℹ duration_ms *[39m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters