diff --git a/examples/sf-specific/deploy.ts b/examples/sf-specific/deploy.ts index 262a5d0..5db8982 100644 --- a/examples/sf-specific/deploy.ts +++ b/examples/sf-specific/deploy.ts @@ -80,10 +80,20 @@ const ms = new MultiStageOutput({ data?.mdapiDeploy?.numberTestsTotal && data?.mdapiDeploy?.numberTestsCompleted ? formatProgress(data?.mdapiDeploy?.numberTestsCompleted, data?.mdapiDeploy?.numberTestsTotal) : undefined, - label: 'Tests', + label: 'Successful', stage: 'Running Tests', type: 'dynamic-key-value', }, + { + get: (data): string | undefined => + data?.mdapiDeploy?.numberTestsTotal && data?.mdapiDeploy?.numberTestsCompleted + ? formatProgress(data?.mdapiDeploy?.numberTestErrors, data?.mdapiDeploy?.numberTestsTotal) + : undefined, + label: 'Failed', + stage: 'Running Tests', + type: 'dynamic-key-value', + }, + { get: (data): string | undefined => data?.sourceMemberPolling?.original @@ -130,6 +140,7 @@ for (let i = 0; i <= tests; i++) { mdapiDeploy: { numberComponentsDeployed: 10, numberComponentsTotal: 10, + numberTestErrors: 0, numberTestsCompleted: i, numberTestsTotal: tests, }, diff --git a/src/components/stages.tsx b/src/components/stages.tsx index 7f7f5ed..8a12492 100644 --- a/src/components/stages.tsx +++ b/src/components/stages.tsx @@ -41,6 +41,10 @@ type Info> = { * Set to `true` to only show this key-value pair or message at the very end of the CI output. Defaults to false. */ onlyShowAtEndInCI?: boolean + /** + * Set to `true` to always render this key-value pair or message in CI output (ignores throttling). Defaults to false. + */ + alwaysPrintInCI?: boolean } export type KeyValuePair> = Info & { diff --git a/src/multi-stage-output.tsx b/src/multi-stage-output.tsx index ed72015..e9c6264 100644 --- a/src/multi-stage-output.tsx +++ b/src/multi-stage-output.tsx @@ -297,9 +297,11 @@ class CIMultiStageOutput> { const key = info.type === 'message' ? formattedData : info.label const str = info.type === 'message' ? formattedData : `${info.label}: ${formattedData}` - const lastUpdateTime = this.lastUpdateByInfo.get(key) - // Skip if the info has been printed before the throttle time - if (lastUpdateTime && Date.now() - lastUpdateTime < this.throttle && !force) continue + if (!info.alwaysPrintInCI) { + const lastUpdateTime = this.lastUpdateByInfo.get(key) + // Skip if the info has been printed before the throttle time + if (lastUpdateTime && Date.now() - lastUpdateTime < this.throttle && !force) continue + } const didPrint = this.maybeStdout(str, indent, force) if (didPrint) this.lastUpdateByInfo.set(key, Date.now())