@@ -3,6 +3,7 @@ import * as fixtures from '../common/fixtures.mjs';
33import { join } from 'node:path' ;
44import { describe , it , run } from 'node:test' ;
55import { dot , spec , tap } from 'node:test/reporters' ;
6+ import consumers from 'node:stream/consumers' ;
67import assert from 'node:assert' ;
78import util from 'node:util' ;
89
@@ -111,34 +112,31 @@ describe('require(\'node:test\').run', { concurrency: true }, () => {
111112 describe ( 'should be piped with spec reporter' , ( ) => {
112113 it ( 'new spec' , async ( ) => {
113114 const specReporter = new spec ( ) ;
114- const result = await run ( {
115+ const result = await consumers . text ( run ( {
115116 files : [ join ( testFixtures , 'default-behavior/test/random.cjs' ) ]
116- } ) . compose ( specReporter ) . toArray ( ) ;
117- const stringResults = result . map ( ( bfr ) => bfr . toString ( ) ) ;
118- assert . match ( stringResults [ 0 ] , / t h i s s h o u l d p a s s / ) ;
119- assert . match ( stringResults [ 1 ] , / t e s t s 1 / ) ;
120- assert . match ( stringResults [ 1 ] , / p a s s 1 / ) ;
117+ } ) . compose ( specReporter ) ) ;
118+ assert . match ( result , / t h i s s h o u l d p a s s / ) ;
119+ assert . match ( result , / t e s t s 1 / ) ;
120+ assert . match ( result , / p a s s 1 / ) ;
121121 } ) ;
122122
123123 it ( 'spec()' , async ( ) => {
124124 const specReporter = spec ( ) ;
125- const result = await run ( {
125+ const result = await consumers . text ( run ( {
126126 files : [ join ( testFixtures , 'default-behavior/test/random.cjs' ) ]
127- } ) . compose ( specReporter ) . toArray ( ) ;
128- const stringResults = result . map ( ( bfr ) => bfr . toString ( ) ) ;
129- assert . match ( stringResults [ 0 ] , / t h i s s h o u l d p a s s / ) ;
130- assert . match ( stringResults [ 1 ] , / t e s t s 1 / ) ;
131- assert . match ( stringResults [ 1 ] , / p a s s 1 / ) ;
127+ } ) . compose ( specReporter ) ) ;
128+ assert . match ( result , / t h i s s h o u l d p a s s / ) ;
129+ assert . match ( result , / t e s t s 1 / ) ;
130+ assert . match ( result , / p a s s 1 / ) ;
132131 } ) ;
133132
134133 it ( 'spec' , async ( ) => {
135- const result = await run ( {
134+ const result = await consumers . text ( run ( {
136135 files : [ join ( testFixtures , 'default-behavior/test/random.cjs' ) ]
137- } ) . compose ( spec ) . toArray ( ) ;
138- const stringResults = result . map ( ( bfr ) => bfr . toString ( ) ) ;
139- assert . match ( stringResults [ 0 ] , / t h i s s h o u l d p a s s / ) ;
140- assert . match ( stringResults [ 1 ] , / t e s t s 1 / ) ;
141- assert . match ( stringResults [ 1 ] , / p a s s 1 / ) ;
136+ } ) . compose ( spec ) ) ;
137+ assert . match ( result , / t h i s s h o u l d p a s s / ) ;
138+ assert . match ( result , / t e s t s 1 / ) ;
139+ assert . match ( result , / p a s s 1 / ) ;
142140 } ) ;
143141 } ) ;
144142
0 commit comments