Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Added
- Include pass rate in execution summary ([#397](https://github.com/cucumber/react-components/pull/397))

## [23.2.0] - 2025-08-07
### Changed
Expand Down
2 changes: 1 addition & 1 deletion src/components/app/ExecutionSummary.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ Platform: [email protected]`)
</EnvelopesProvider>
)

expect(screen.getByText('55.5% passed')).to.be.visible
expect(screen.getByText('55.5% (5 / 9) passed')).to.be.visible
})

it('should include the job link', () => {
Expand Down
5 changes: 5 additions & 0 deletions src/components/app/ExecutionSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import React, { FC } from 'react'

import { formatExecutionDistance } from '../../formatExecutionDistance.js'
import { formatExecutionDuration } from '../../formatExecutionDuration.js'
import { formatPassedQuantity } from '../../formatPassedQuantity.js'
import { formatStatusRate } from '../../formatStatusRate.js'
import { useQueries } from '../../hooks/index.js'
import { useResultStatistics } from '../../hooks/useResultStatistics.js'
Expand Down Expand Up @@ -62,6 +63,10 @@ export const ExecutionSummary: FC = () => {
{formatStatusRate(
scenarioCountByStatus[TestStepResultStatus.PASSED],
totalScenarioCount
)}{' '}
{formatPassedQuantity(
scenarioCountByStatus[TestStepResultStatus.PASSED],
totalScenarioCount
)}
{' passed'}
</span>
Expand Down
22 changes: 22 additions & 0 deletions src/formatPassedQuantity.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { expect } from 'chai'

import { formatPassedQuantity } from './formatPassedQuantity.js'

describe('formatPassedQuantity', () => {
const examples: [passed: number, total: number, proportion: string][] = [
[13, 45, '(13 / 45)'],
[5, 45, '(5 / 45)'],
[45, 45, '(45 / 45)'],
[0, 45, '(0 / 45)'],
[0, 0, '(0 / 0)'],
[999, 1000, '(999 / 1000)'],
[99999, 100000, '(99999 / 100000)'],
[9999999, 10000000, '(9999999 / 10000000)'],
]

for (const [passed, total, proportion] of examples) {
it(`should render correctly for ${proportion}`, () => {
expect(formatPassedQuantity(passed, total)).to.eq(proportion)
})
}
})
3 changes: 3 additions & 0 deletions src/formatPassedQuantity.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function formatPassedQuantity(passed: number, total: number) {
return `(${passed} / ${total})`
}