Skip to content

Commit

Permalink
fix: dont capital case stage
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Sep 25, 2024
1 parent 876a4f8 commit bb5ffaa
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 44 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 4 additions & 5 deletions src/components/stages.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -228,7 +227,7 @@ function CompactStage({
<Box flexDirection={direction}>
<SpinnerOrError
error={error}
label={`[${stageTracker.indexOf(stage) + 1}/${stageTracker.size}] ${capitalCase(stage)}`}
label={`[${stageTracker.indexOf(stage) + 1}/${stageTracker.size}] ${stage}`}
type={design.spinners.stage}
design={design}
/>
Expand All @@ -255,18 +254,18 @@ function Stage({
return (
<Box flexWrap="wrap">
{(status === 'current' || status === 'failed') && (
<SpinnerOrError error={error} label={capitalCase(stage)} type={design.spinners.stage} design={design} />
<SpinnerOrError error={error} label={stage} type={design.spinners.stage} design={design} />
)}

{status === 'skipped' && (
<Icon icon={design.icons.skipped}>
<Text color="dim">{capitalCase(stage)} - Skipped</Text>
<Text color="dim">{stage} - Skipped</Text>
</Icon>
)}

{status !== 'skipped' && status !== 'failed' && status !== 'current' && (
<Icon icon={design.icons[status]}>
<Text>{capitalCase(stage)}</Text>
<Text>{stage}</Text>
</Icon>
)}
</Box>
Expand Down
3 changes: 1 addition & 2 deletions src/multi-stage-output.tsx
Original file line number Diff line number Diff line change
@@ -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'
Expand Down Expand Up @@ -139,7 +138,7 @@ class CIMultiStageOutput<T extends Record<string, unknown>> {
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()
Expand Down
62 changes: 31 additions & 31 deletions test/components/stages.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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:')
})

Expand All @@ -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:')
})

Expand All @@ -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:')
})

Expand All @@ -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:')
})

Expand All @@ -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:')
})

Expand All @@ -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:')
})

Expand All @@ -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:')
})

Expand Down Expand Up @@ -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
`)
})

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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`)
Expand Down Expand Up @@ -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:')
Expand All @@ -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:')
Expand All @@ -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:')
Expand All @@ -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:')
Expand All @@ -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:')
Expand All @@ -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:')
})
Expand All @@ -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:')
})
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit bb5ffaa

Please sign in to comment.