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 <cjihrig@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
This commit is contained in:
Giovanni Bucci 2024-09-13 01:13:04 +02:00 committed by GitHub
parent f5f67ae4a7
commit 92ca0b7ec1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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', () => {