Skip to content

Commit

Permalink
Treat duration_ms as a time directive
Browse files Browse the repository at this point in the history
Fix: #895
  • Loading branch information
isaacs committed Sep 19, 2023
1 parent e42ea1a commit b03f951
Show file tree
Hide file tree
Showing 5 changed files with 1,190 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/parser/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,14 @@ export class Parser
return
}

if (
typeof diags.duration_ms === 'number' &&
this.#current.time === null
) {
this.#current.time = diags.duration_ms
delete diags.duration_ms
}

this.#current.diag = diags
// we still don't emit the result here yet, to support diags
// that come ahead of buffered subtests.
Expand Down
1 change: 1 addition & 0 deletions src/parser/src/parse-directive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export const parseDirective = (
if (!line.trim()) return false

line = line.replace(OPEN_BRACE_EOL, '').trim()
.replace(/^duration_ms ([0-9.]+)$/, 'time=$1ms')
const time = line.match(
/^time=((?:[1-9][0-9]*|0)(?:\.[0-9]+)?)(ms|s)$/i
)
Expand Down
Loading

0 comments on commit b03f951

Please sign in to comment.