Merge branch 'dev' into mocha-json

This commit is contained in:
Michal Dorner 2021-04-01 00:05:41 +02:00
commit ee126813a2
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
24 changed files with 3653 additions and 1304 deletions

View file

@ -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`

View file

@ -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))
}