11import { glob } from "glob" ;
2- import cliProgress from "cli-progress" ;
32import { Worker } from "worker_threads" ;
43import path from "path" ;
54import { fileURLToPath } from "url" ;
@@ -28,21 +27,6 @@ console.log(`🧪 Validating ${targets.length} files with ${MAX_WORKERS} paralle
2827await validateParallel ( ) ;
2928
3029async function validateParallel ( ) {
31- const multibar = new cliProgress . MultiBar (
32- {
33- format : "[{bar}] {percentage}% | {value}/{total} | {status}" ,
34- hideCursor : true ,
35- clearOnComplete : false ,
36- stopOnComplete : true ,
37- forceRedraw : false ,
38- } ,
39- cliProgress . Presets . shades_classic ,
40- ) ;
41-
42- const overallBar = multibar . create ( targets . length , 0 , {
43- status : "Starting..." ,
44- } ) ;
45-
4630 let completedTasks = 0 ;
4731 let allTestsPassed = true ;
4832 const results = [ ] ;
@@ -54,7 +38,6 @@ async function validateParallel() {
5438 if ( isDone ) return ;
5539 isDone = true ;
5640
57- multibar . stop ( ) ;
5841 workers . forEach ( ( worker ) => worker . terminate ( ) ) ;
5942
6043 const failedResults = results . filter ( ( r ) => ! r . isValid ) ;
@@ -65,9 +48,6 @@ async function validateParallel() {
6548
6649 if ( failedResults . length > 0 ) {
6750 console . log ( `❌ ${ failedResults . length } files failed validation` ) ;
68- failedResults . forEach ( ( result ) => {
69- console . log ( `\n✅ File: ${ path . relative ( process . cwd ( ) , result . filePath ) } \n${ result . message . trim ( ) } ` ) ;
70- } ) ;
7151 process . exit ( 1 ) ;
7252 } else {
7353 console . log ( "✨ All tests passed!\n" ) ;
@@ -81,15 +61,20 @@ async function validateParallel() {
8161 completedTasks ++ ;
8262 results . push ( result ) ;
8363
64+ const relativeFilePath = path . relative ( process . cwd ( ) , result . filePath ) ;
65+
8466 if ( ! result . isValid ) {
8567 allTestsPassed = false ;
86- multibar . log ( `❌ ${ path . relative ( process . cwd ( ) , result . filePath ) } \n${ result . message . trim ( ) } \n\n` ) ;
68+ console . log ( `❌ (${ completedTasks } of ${ targets . length } ) ${ relativeFilePath } ` ) ;
69+ // Print error messages with indentation
70+ const errorLines = result . message . trim ( ) . split ( "\n" ) ;
71+ errorLines . forEach ( ( line ) => {
72+ console . log ( `- ${ line } ` ) ;
73+ } ) ;
74+ } else {
75+ console . log ( `✅ (${ completedTasks } of ${ targets . length } ) ${ relativeFilePath } ` ) ;
8776 }
8877
89- overallBar . increment ( 1 , {
90- status : path . basename ( result . filePath ) ,
91- } ) ;
92-
9378 if ( taskQueue . length > 0 ) {
9479 const nextTask = taskQueue . shift ( ) ;
9580 worker . postMessage ( { filePath : nextTask , workerId } ) ;
0 commit comments