@@ -5,12 +5,16 @@ const { Suite } = require("../lib");
55
66const {
77 chartReport,
8+ toChart,
89 htmlReport,
910 jsonReport,
11+ toJSON,
1012 csvReport,
13+ toCSV,
1114 prettyReport,
15+ toPretty,
1216 textReport,
13- toCSV ,
17+ toText ,
1418} = require ( "../lib/report" ) ;
1519
1620const { analyze, summarize } = require ( "../lib/utils/analyze.js" ) ;
@@ -463,17 +467,11 @@ describe("baseline comparisons", async (t) => {
463467 } ) ;
464468 } ) ;
465469
466- describe ( "for prettyReport " , async ( t ) => {
470+ describe ( "for pretty report " , async ( t ) => {
467471 let output = "" ;
468472
469473 before ( async ( ) => {
470- const originalStdoutWrite = process . stdout . write ;
471- process . stdout . write = ( data ) => {
472- output += data ;
473- } ;
474-
475- prettyReport ( results ) ;
476- process . stdout . write = originalStdoutWrite ;
474+ output = toPretty ( results ) ;
477475 } ) ;
478476
479477 it ( "should include a summary section" , ( ) => {
@@ -491,17 +489,11 @@ describe("baseline comparisons", async (t) => {
491489 } ) ;
492490 } ) ;
493491
494- describe ( "for textReport " , async ( t ) => {
492+ describe ( "for text Report " , async ( t ) => {
495493 let output = "" ;
496494
497495 before ( async ( ) => {
498- const originalStdoutWrite = process . stdout . write ;
499- process . stdout . write = ( data ) => {
500- output += data ;
501- } ;
502-
503- textReport ( results ) ;
504- process . stdout . write = originalStdoutWrite ;
496+ output = toText ( results ) ;
505497 } ) ;
506498
507499 it ( "should include a summary section" , ( ) => {
@@ -519,17 +511,11 @@ describe("baseline comparisons", async (t) => {
519511 } ) ;
520512 } ) ;
521513
522- describe ( "for chartReport " , async ( t ) => {
514+ describe ( "for chart Report " , async ( t ) => {
523515 let output = "" ;
524516
525517 before ( async ( ) => {
526- const originalStdoutWrite = process . stdout . write ;
527- process . stdout . write = ( data ) => {
528- output += data ;
529- } ;
530-
531- chartReport ( results , { labelWidth : 30 } ) ;
532- process . stdout . write = originalStdoutWrite ;
518+ output = toChart ( results , { labelWidth : 30 } ) ;
533519 } ) ;
534520
535521 it ( "should include a summary section" , ( ) => {
0 commit comments