Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replace duration with luxon for formatting #2204

Merged
merged 3 commits into from
Dec 28, 2022
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ Please see [CONTRIBUTING.md](https://github.com/cucumber/cucumber/blob/master/CO
### Added
- Add support for YAML as a configuration file format ([#2199](https://github.com/cucumber/cucumber-js/pull/2199))

### Changed
- Replace `duration` with `luxon` for formatting durations ([#2204](https://github.com/cucumber/cucumber-js/pull/2204))

## [8.9.1] - 2022-12-16
### Fixed
- Include original coordinates in `loadSupport` result ([#2197](https://github.com/cucumber/cucumber-js/pull/2197))
Expand Down
170 changes: 27 additions & 143 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@
"cli-table3": "0.6.3",
"commander": "^9.0.0",
"debug": "^4.3.4",
"duration": "^0.2.2",
"durations": "^3.4.2",
"error-stack-parser": "^2.1.4",
"figures": "^3.2.0",
Expand All @@ -223,6 +222,7 @@
"knuth-shuffle-seeded": "^1.0.6",
"lodash.merge": "^4.6.2",
"lodash.mergewith": "^4.6.2",
"luxon": "^3.1.1",
"mz": "^2.7.0",
"progress": "^2.0.3",
"resolve-pkg": "^2.0.0",
Expand Down Expand Up @@ -253,6 +253,7 @@
"@types/has-ansi": "5.0.0",
"@types/lodash.merge": "4.6.7",
"@types/lodash.mergewith": "4.6.7",
"@types/luxon": "^3.1.0",
"@types/mocha": "10.0.1",
"@types/mustache": "4.2.2",
"@types/mz": "2.7.4",
Expand Down
11 changes: 7 additions & 4 deletions src/formatter/helpers/summary_helpers.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import Duration from 'duration'
import { IColorFns } from '../get_color_fns'
import { ITestCaseAttempt } from './event_data_collector'
import * as messages from '@cucumber/messages'
import { doesHaveValue } from '../../value_checker'
import { Interval } from 'luxon'

const STATUS_REPORT_ORDER = [
messages.TestStepResultStatus.FAILED,
Expand Down Expand Up @@ -98,7 +98,10 @@ function getDurationSummary(durationMsg: messages.Duration): string {
const end = new Date(
messages.TimeConversion.durationToMilliseconds(durationMsg)
)
const duration = new Duration(start, end)
// Use spaces in toString method for readability and to avoid %Ls which is a format
return duration.toString('%Ms m %S . %L s').replace(/ /g, '')
const duration = Interval.fromDateTimes(start, end).toDuration([
'minutes',
'seconds',
'milliseconds',
])
return duration.toFormat("m'm'ss.SSS's'")
}
19 changes: 0 additions & 19 deletions src/types/duration/index.d.ts

This file was deleted.