Skip to content

Commit 929c3c3

Browse files
committed
fixup!
1 parent 2ea6e52 commit 929c3c3

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

test/parallel/test-util-styletext.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ const assert = require('node:assert');
55
const util = require('node:util');
66
const { WriteStream } = require('node:tty');
77

8+
process.env.FORCE_COLOR = '1';
9+
810
const styled = '\u001b[31mtest\u001b[39m';
911
const noChange = 'test';
1012

@@ -36,6 +38,14 @@ assert.throws(() => {
3638
code: 'ERR_INVALID_ARG_VALUE',
3739
});
3840

41+
assert.throws(() => {
42+
util.styleText(['invalid'], 'text');
43+
}, {
44+
code: 'ERR_INVALID_ARG_VALUE',
45+
});
46+
47+
process.env.FORCE_COLOR = '0';
48+
3949
assert.strictEqual(
4050
util.styleText('red', 'test', { validateStream: false }),
4151
'\u001b[31mtest\u001b[39m',
@@ -132,12 +142,6 @@ assert.strictEqual(
132142
),
133143
);
134144

135-
assert.throws(() => {
136-
util.styleText(['invalid'], 'text');
137-
}, {
138-
code: 'ERR_INVALID_ARG_VALUE',
139-
});
140-
141145
assert.throws(() => {
142146
util.styleText('red', 'text', { stream: {} });
143147
}, {
@@ -154,6 +158,8 @@ assert.strictEqual(
154158

155159
assert.strictEqual(util.styleText('none', 'test'), 'test');
156160

161+
delete process.env.FORCE_COLOR;
162+
157163
const fd = common.getTTYfd();
158164
if (fd !== -1) {
159165
const writeStream = new WriteStream(fd);

0 commit comments

Comments
 (0)