mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-17 06:47:09 +01:00
Add dotnet-trx support (no annotations yet)
This commit is contained in:
parent
6482e393f9
commit
b28f91cc2e
7 changed files with 247 additions and 4 deletions
|
|
@ -1,8 +1,23 @@
|
|||
export function parseAttribute(str: string | undefined): string | number | undefined {
|
||||
const isoDateRe = /^\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)$/
|
||||
|
||||
// matches dotnet duration: 00:00:00.0010000
|
||||
const durationRe = /^(\d\d):(\d\d):(\d\d\.\d+)$/
|
||||
|
||||
export function parseAttribute(str: string | undefined): string | Date | number | undefined {
|
||||
if (str === '' || str === undefined) {
|
||||
return str
|
||||
}
|
||||
|
||||
if (isoDateRe.test(str)) {
|
||||
return new Date(str)
|
||||
}
|
||||
|
||||
const durationMatch = str.match(durationRe)
|
||||
if (durationMatch !== null) {
|
||||
const [_, hourStr, minStr, secStr] = durationMatch
|
||||
return (parseInt(hourStr) * 3600 + parseInt(minStr) * 60 + parseFloat(secStr)) * 1000
|
||||
}
|
||||
|
||||
const num = parseFloat(str)
|
||||
if (isNaN(num)) {
|
||||
return str
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue