Skip to content

Commit

Permalink
use util.styleText() for %c expected values
Browse files Browse the repository at this point in the history
  • Loading branch information
jcbhmr committed May 23, 2024
1 parent 69d597a commit fd7b748
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test/parallel/test-util-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ assert.strictEqual(

assert.strictEqual(

Check failure on line 557 in test/parallel/test-util-format.js

View workflow job for this annotation

GitHub Actions / test-linux

--- stderr --- node:assert:126 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: + actual - expected + '\x1B[31mfoo\x1B[0m' - '\x1B[31mfoo\x1B[39m' ^ at Object.<anonymous> (/home/runner/work/node/node/test/parallel/test-util-format.js:557:8) at Module._compile (node:internal/modules/cjs/loader:1434:14) at Module._extensions..js (node:internal/modules/cjs/loader:1518:10) at Module.load (node:internal/modules/cjs/loader:1249:32) at Module._load (node:internal/modules/cjs/loader:1065:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12) at node:internal/main/run_main_module:30:49 { generatedMessage: true, code: 'ERR_ASSERTION', actual: '\x1B[31mfoo\x1B[0m', expected: '\x1B[31mfoo\x1B[39m', operator: 'strictEqual' } Node.js v23.0.0-pre Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /home/runner/work/node/node/test/parallel/test-util-format.js

Check failure on line 557 in test/parallel/test-util-format.js

View workflow job for this annotation

GitHub Actions / test-macOS

--- stderr --- node:assert:126 throw new AssertionError(obj); ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: + actual - expected + '\x1B[31mfoo\x1B[0m' - '\x1B[31mfoo\x1B[39m' ^ at Object.<anonymous> (/Users/runner/work/node/node/test/parallel/test-util-format.js:557:8) at Module._compile (node:internal/modules/cjs/loader:1434:14) at Module._extensions..js (node:internal/modules/cjs/loader:1518:10) at Module.load (node:internal/modules/cjs/loader:1249:32) at Module._load (node:internal/modules/cjs/loader:1065:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:158:12) at node:internal/main/run_main_module:30:49 { generatedMessage: true, code: 'ERR_ASSERTION', actual: '\x1B[31mfoo\x1B[0m', expected: '\x1B[31mfoo\x1B[39m', operator: 'strictEqual' } Node.js v23.0.0-pre Command: out/Release/node --test-reporter=spec --test-reporter-destination=stdout --test-reporter=./tools/github_reporter/index.js --test-reporter-destination=stdout /Users/runner/work/node/node/test/parallel/test-util-format.js
util.formatWithOptions({ colors: true }, '%cfoo', 'color: red'),
'\x1b[31mfoo\x1b[0m'
util.styleText('red', 'foo')
);

assert.strictEqual(
Expand All @@ -565,17 +565,17 @@ assert.strictEqual(
'%cfoo',
'color: red; background-color: blue'
),
'\x1B[44m\x1B[31mfoo\x1B[0m'
util.styleText(['red', 'bgBlue'], 'foo')
);

assert.strictEqual(
util.formatWithOptions({ colors: true }, '%cfoo', 'color: red', 'bar'),
'\x1b[31mfoo\x1b[0m bar'
`${util.styleText('red', 'foo')} bar`
);

assert.strictEqual(
util.formatWithOptions({ colors: true }, '%cfoo%c bar', 'color: red', ''),
'\x1b[31mfoo\x1b[39m bar\x1b[0m'
`${util.styleText('red', 'foo')} bar`
);

assert.strictEqual(
Expand All @@ -585,5 +585,5 @@ assert.strictEqual(
'color: red',
'color: blue'
),
'\x1b[31mfoo \x1b[34mbar\x1b[0m'
`${util.styleText('red', 'foo ')}${util.styleText('blue', 'bar')}`
);

0 comments on commit fd7b748

Please sign in to comment.