From ca1e8f8c4493f76759411394c4b0049cc90a7f50 Mon Sep 17 00:00:00 2001 From: Sam Reid Date: Thu, 2 Jun 2022 06:08:59 -0600 Subject: [PATCH] Improve error counting, see https://github.com/phetsims/chipper/issues/1247 --- js/scripts/absolute-tsc.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/scripts/absolute-tsc.js b/js/scripts/absolute-tsc.js index 1fd67965..aecb93d7 100644 --- a/js/scripts/absolute-tsc.js +++ b/js/scripts/absolute-tsc.js @@ -57,7 +57,10 @@ if ( !args || args.length === 0 ) { } } ); + // If a line starts without whitespace, it begins a new error + const errorCount = mapped.filter( line => line === line.trim() ).length; + console.log( mapped.join( '\n' ) ); - console.log( `${mapped.length} ${mapped.length === 1 ? 'error' : 'errors'} in ${elapsed}ms` ); + console.log( `${errorCount} ${errorCount === 1 ? 'error' : 'errors'} in ${elapsed}ms` ); } } )();