From bb5ffaa0e72c96fb1dad5aef2d6b90dfed76fc25 Mon Sep 17 00:00:00 2001 From: Mike Donnalley Date: Wed, 25 Sep 2024 11:21:24 -0600 Subject: [PATCH] fix: dont capital case stage --- package.json | 1 - src/components/stages.tsx | 9 +++-- src/multi-stage-output.tsx | 3 +- test/components/stages.test.tsx | 62 ++++++++++++++++----------------- yarn.lock | 5 --- 5 files changed, 36 insertions(+), 44 deletions(-) diff --git a/package.json b/package.json index d02bff8..06fdeb5 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,6 @@ "dependencies": { "@oclif/core": "^4", "@types/react": "^18.3.8", - "change-case": "^5.4.4", "cli-spinners": "^2", "figures": "^6.1.0", "ink": "^5.0.1", diff --git a/src/components/stages.tsx b/src/components/stages.tsx index 66ed47a..a6af139 100644 --- a/src/components/stages.tsx +++ b/src/components/stages.tsx @@ -1,5 +1,4 @@ import {getLogger} from '@oclif/core/logger' -import {capitalCase} from 'change-case' import {Box, Text, useStdout} from 'ink' import React, {ErrorInfo} from 'react' import wrapAnsi from 'wrap-ansi' @@ -228,7 +227,7 @@ function CompactStage({ @@ -255,18 +254,18 @@ function Stage({ return ( {(status === 'current' || status === 'failed') && ( - + )} {status === 'skipped' && ( - {capitalCase(stage)} - Skipped + {stage} - Skipped )} {status !== 'skipped' && status !== 'failed' && status !== 'current' && ( - {capitalCase(stage)} + {stage} )} diff --git a/src/multi-stage-output.tsx b/src/multi-stage-output.tsx index b386225..1852eb0 100644 --- a/src/multi-stage-output.tsx +++ b/src/multi-stage-output.tsx @@ -1,5 +1,4 @@ import {ux} from '@oclif/core/ux' -import {capitalCase} from 'change-case' import {Instance, render} from 'ink' import {env} from 'node:process' import React from 'react' @@ -139,7 +138,7 @@ class CIMultiStageOutput> { if (title) ux.stdout(`───── ${title} ─────`) ux.stdout('Stages:') for (const stage of this.stages) { - ux.stdout(`${this.stages.indexOf(stage) + 1}. ${capitalCase(stage)}`) + ux.stdout(`${this.stages.indexOf(stage) + 1}. ${stage}`) } ux.stdout() diff --git a/test/components/stages.test.tsx b/test/components/stages.test.tsx index 147fd84..011a97c 100644 --- a/test/components/stages.test.tsx +++ b/test/components/stages.test.tsx @@ -37,8 +37,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.pending.figure} Step1`) - expect(lastFrame).to.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step1`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('Elapsed Time:') }) @@ -49,8 +49,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.completed.figure} Step1`) - expect(lastFrame).to.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`${design.icons.completed.figure} step1`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('Elapsed Time:') }) @@ -62,8 +62,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.skipped.figure} Step1 - Skipped`) - expect(lastFrame).to.include(`${design.icons.completed.figure} Step2`) + expect(lastFrame).to.include(`${design.icons.skipped.figure} step1 - Skipped`) + expect(lastFrame).to.include(`${design.icons.completed.figure} step2`) expect(lastFrame).to.include('Elapsed Time:') }) @@ -76,8 +76,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.failed.figure} Step1`) - expect(lastFrame).to.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`${design.icons.failed.figure} step1`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('Elapsed Time:') }) @@ -89,8 +89,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.pending.figure} Step1`) - expect(lastFrame).to.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step1`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.not.include('Elapsed Time:') }) @@ -101,8 +101,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.completed.figure} Step1 0ms`) - expect(lastFrame).to.include(`${design.icons.pending.figure} Step2\n`) + expect(lastFrame).to.include(`${design.icons.completed.figure} step1 0ms`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step2\n`) expect(lastFrame).to.include('Elapsed Time:') }) @@ -115,8 +115,8 @@ describe('Stages', () => { unmount() const lastFrame = lastValidFrame(frames) expect(lastFrame).to.include('─ Test ─') - expect(lastFrame).to.include(`${design.icons.completed.figure} Step1\n`) - expect(lastFrame).to.include(`${design.icons.pending.figure} Step2\n`) + expect(lastFrame).to.include(`${design.icons.completed.figure} step1\n`) + expect(lastFrame).to.include(`${design.icons.pending.figure} step2\n`) expect(lastFrame).to.include('Elapsed Time:') }) @@ -149,7 +149,7 @@ describe('Stages', () => { Static: this is a static key:value pair Dynamic: this is a dynamic key:value pair - ${design.icons.pending.figure} Step1 + ${design.icons.pending.figure} step1 `) }) @@ -178,7 +178,7 @@ describe('Stages', () => { ) unmount() const lastFrame = lastValidFrame(frames) - expect(lastFrame).to.include(` ${design.icons.pending.figure} Step2 + expect(lastFrame).to.include(` ${design.icons.pending.figure} step2 this is a message Static: this is a static key:value pair @@ -213,7 +213,7 @@ describe('Stages', () => { ) unmount() const lastFrame = lastValidFrame(frames) - expect(lastFrame).to.include(` ${design.icons.completed.figure} Step1 0ms + expect(lastFrame).to.include(` ${design.icons.completed.figure} step1 0ms ${design.icons.info.figure} this is a message ${design.icons.info.figure} Static: this is a static key:value pair ${design.icons.info.figure} Dynamic: this is a dynamic key:value pair`) @@ -242,8 +242,8 @@ describe('Stages', () => { const lastFrame = renderStages(1) expect(lastFrame).to.include('─ Test ─') expect(lastFrame).to.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`[1/2] step1`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('stage-specific hello') expect(lastFrame).to.include('post-stage hello') expect(lastFrame).to.include('Elapsed Time:') @@ -253,8 +253,8 @@ describe('Stages', () => { const lastFrame = renderStages(2) expect(lastFrame).to.include('─ Test ─') expect(lastFrame).to.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`[1/2] step1`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('stage-specific hello') expect(lastFrame).to.include('post-stage hello') expect(lastFrame).to.not.include('Elapsed Time:') @@ -264,8 +264,8 @@ describe('Stages', () => { const lastFrame = renderStages(3) expect(lastFrame).to.not.include('─ Test ─') expect(lastFrame).to.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`[1/2] step1`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('stage-specific hello') expect(lastFrame).to.include('post-stage hello') expect(lastFrame).to.not.include('Elapsed Time:') @@ -275,8 +275,8 @@ describe('Stages', () => { const lastFrame = renderStages(4) expect(lastFrame).to.not.include('─ Test ─') expect(lastFrame).to.not.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`[1/2] step1`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('stage-specific hello') expect(lastFrame).to.include('post-stage hello') expect(lastFrame).to.not.include('Elapsed Time:') @@ -286,8 +286,8 @@ describe('Stages', () => { const lastFrame = renderStages(5) expect(lastFrame).to.not.include('─ Test ─') expect(lastFrame).to.not.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.include(`[1/2] step1`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.include('stage-specific hello') expect(lastFrame).to.not.include('post-stage hello') expect(lastFrame).to.not.include('Elapsed Time:') @@ -297,9 +297,9 @@ describe('Stages', () => { const lastFrame = renderStages(6) expect(lastFrame).to.not.include('─ Test ─') expect(lastFrame).to.not.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) + expect(lastFrame).to.include(`[1/2] step1`) expect(lastFrame).to.include('stage-specific hello 0ms') - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.not.include('post-stage hello') expect(lastFrame).to.not.include('Elapsed Time:') }) @@ -308,9 +308,9 @@ describe('Stages', () => { const lastFrame = renderStages(7) expect(lastFrame).to.not.include('─ Test ─') expect(lastFrame).to.not.include('pre-stage hello') - expect(lastFrame).to.include(`[1/2] Step1`) + expect(lastFrame).to.include(`[1/2] step1`) expect(lastFrame).to.not.include('stage-specific hello 0ms') - expect(lastFrame).to.not.include(`${design.icons.pending.figure} Step2`) + expect(lastFrame).to.not.include(`${design.icons.pending.figure} step2`) expect(lastFrame).to.not.include('post-stage hello') expect(lastFrame).to.not.include('Elapsed Time:') }) diff --git a/yarn.lock b/yarn.lock index 8ff8a39..848be4b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -932,11 +932,6 @@ chalk@^5.3.0, chalk@~5.3.0: resolved "https://registry.yarnpkg.com/chalk/-/chalk-5.3.0.tgz#67c20a7ebef70e7f3970a01f90fa210cb6860385" integrity sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w== -change-case@^5.4.4: - version "5.4.4" - resolved "https://registry.yarnpkg.com/change-case/-/change-case-5.4.4.tgz#0d52b507d8fb8f204343432381d1a6d7bff97a02" - integrity sha512-HRQyTk2/YPEkt9TnUPbOpr64Uw3KOicFWPVBb+xiHvd6eBx/qPr9xqfBFDT8P2vWsvvz4jbEkfDe71W3VyNu2w== - check-error@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/check-error/-/check-error-1.0.3.tgz#a6502e4312a7ee969f646e83bb3ddd56281bd694"