@@ -3,6 +3,7 @@ import os from 'node:os';
33import ora , { type Ora } from 'ora' ;
44import { dateToUnixTimestamp } from './dates.js' ;
55import { isEnvVarEnabled } from './env.js' ;
6+ import { stringifyError } from './errors.js' ;
67import { formatDuration , indentLines , transformLines } from './formatting.js' ;
78import { settlePromise } from './promises.js' ;
89
@@ -19,12 +20,11 @@ const GROUP_COLOR_ENV_VAR_NAME = 'CP_LOGGER_GROUP_COLOR';
1920export class Logger {
2021 #isVerbose = isEnvVarEnabled ( 'CP_VERBOSE' ) ;
2122 #isCI = isEnvVarEnabled ( 'CI' ) ;
22- #ciPlatform: CiPlatform | undefined =
23- process . env [ 'GITHUB_ACTIONS' ] === 'true'
24- ? 'GitHub Actions'
25- : process . env [ 'GITLAB_CI' ] === 'true'
26- ? 'GitLab CI/CD'
27- : undefined ;
23+ #ciPlatform: CiPlatform | undefined = isEnvVarEnabled ( 'GITHUB_ACTIONS' )
24+ ? 'GitHub Actions'
25+ : isEnvVarEnabled ( 'GITLAB_CI' )
26+ ? 'GitLab CI/CD'
27+ : undefined ;
2828 #groupColor: GroupColor | undefined =
2929 process . env [ GROUP_COLOR_ENV_VAR_NAME ] === 'cyan' ||
3030 process . env [ GROUP_COLOR_ENV_VAR_NAME ] === 'magenta'
@@ -275,7 +275,10 @@ export class Logger {
275275 console . log (
276276 [
277277 this . #colorize( this . #groupSymbols. end , this . #groupColor) ,
278- this . #colorize( `${ result . reason } ` , 'red' ) ,
278+ this . #colorize(
279+ `${ stringifyError ( result . reason , { oneline : true } ) } ` ,
280+ 'red' ,
281+ ) ,
279282 ] . join ( ' ' ) ,
280283 ) ;
281284 }
@@ -391,7 +394,7 @@ export class Logger {
391394 messages . success ( result . value ) ,
392395 this . #formatDurationSuffix( { start, end } ) ,
393396 ] . join ( ' ' )
394- : messages . failure ( result . reason ) ;
397+ : messages . failure ( stringifyError ( result . reason , { oneline : true } ) ) ;
395398
396399 if ( this . #activeSpinner) {
397400 if ( this . #groupColor) {
0 commit comments