test: isolate styleText tests from the environment · nodejs/node@f63ddfa · GitHub
Skip to content

Commit f63ddfa

Browse files
panvaaduh95
authored andcommitted
test: isolate styleText tests from the environment
The TTY cases inherit TERM, CI and the color override variables. These can disable colors in a case expecting styling, or force colors in a case expecting plain text. The tests skip these cases without a TTY, which hides the dependency in many standalone runs. Set a color-capable TERM and only the environment variables specified by each case. Remove the RISC-V flaky expectations. Refs: nodejs/build#4099 (comment) Signed-off-by: Filip Skokan <panva.ip@gmail.com> Assisted-by: Claude, Codex PR-URL: #66320 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent a3ffd40 commit f63ddfa

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎test/parallel/parallel.status‎

Lines changed: 0 additions & 5 deletions

‎test/parallel/test-util-styletext-hex.js‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,10 @@ describe('util.styleText hex color support', () => {
213213
for (const testCase of testCases) {
214214
it(`should respect ${testCase.description}`, () => {
215215
writeStream.isTTY = testCase.isTTY;
216+
// Do not inherit color-related variables (TERM, CI, NO_COLOR, ...)
217+
// from the environment the test happens to run in.
216218
process.env = {
217-
...originalEnv,
219+
TERM: 'xterm-256color',
218220
...testCase.env,
219221
};
220222
const output = util.styleText('#ffcc00', 'test', { stream: writeStream });

‎test/parallel/test-util-styletext.js‎

Lines changed: 4 additions & 2 deletions

0 commit comments

Comments
 (0)