mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
Merge branch 'dev' into mocha-json
This commit is contained in:
commit
ee126813a2
24 changed files with 3653 additions and 1304 deletions
|
|
@ -41,7 +41,7 @@ export function ellipsis(text: string, maxLength: number): string {
|
|||
|
||||
export function formatTime(ms: number): string {
|
||||
if (ms > 1000) {
|
||||
return `${(ms / 1000).toFixed(3)}s`
|
||||
return `${Math.round(ms / 1000)}s`
|
||||
}
|
||||
|
||||
return `${Math.round(ms)}ms`
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
export function parseNetDuration(str: string): number {
|
||||
// matches dotnet duration: 00:00:00.0010000
|
||||
const durationRe = /^(\d\d):(\d\d):(\d\d\.\d+)$/
|
||||
const durationRe = /^(\d\d):(\d\d):(\d\d(?:\.\d+)?)$/
|
||||
const durationMatch = str.match(durationRe)
|
||||
if (durationMatch === null) {
|
||||
throw new Error(`Invalid format: "${str}" is not NET duration`)
|
||||
|
|
@ -18,3 +17,8 @@ export function parseIsoDate(str: string): Date {
|
|||
|
||||
return new Date(str)
|
||||
}
|
||||
|
||||
export function getFirstNonEmptyLine(stackTrace: string): string | undefined {
|
||||
const lines = stackTrace.split(/\r?\n/g)
|
||||
return lines.find(str => !/^\s*$/.test(str))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue