From ee385d62b96b5684ed8fd7969d9aae1a2ddd39a2 Mon Sep 17 00:00:00 2001 From: Giovanni Bucci Date: Fri, 13 Sep 2024 01:13:04 +0200 Subject: [PATCH] test: strip color chars in `test-runner-run` Fixes: https://github.com/nodejs/node/issues/54551 PR-URL: https://github.com/nodejs/node/pull/54552 Reviewed-By: Colin Ihrig Reviewed-By: Matteo Collina --- test/parallel/test-runner-run.mjs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-runner-run.mjs b/test/parallel/test-runner-run.mjs index 7a575da9c95275..c423465ab849ae 100644 --- a/test/parallel/test-runner-run.mjs +++ b/test/parallel/test-runner-run.mjs @@ -4,6 +4,7 @@ import { join } from 'node:path'; import { describe, it, run } from 'node:test'; import { dot, spec, tap } from 'node:test/reporters'; import assert from 'node:assert'; +import util from 'node:util'; const testFixtures = fixtures.path('test-runner'); @@ -68,10 +69,10 @@ describe('require(\'node:test\').run', { concurrency: true }, () => { const result = await run({ files: [join(testFixtures, 'default-behavior/test/random.cjs')] }).compose(dot).toArray(); - assert.deepStrictEqual(result, [ - '.', - '\n', - ]); + + assert.strictEqual(result.length, 2); + assert.strictEqual(util.stripVTControlCharacters(result[0]), '.'); + assert.strictEqual(result[1], '\n'); }); describe('should be piped with spec reporter', () => {