mirror of
https://github.com/dorny/test-reporter.git
synced 2026-02-01 02:45:22 -08:00
23 lines
523 B
TypeScript
23 lines
523 B
TypeScript
export interface StackTraceElement {
|
|
tracePath: string
|
|
fileName: string
|
|
lineStr: string
|
|
}
|
|
|
|
// simple format:
|
|
// at <FULLY_QUALIFIED_METHOD_NAME>(<FILE_NAME>:<LINE_NUMBER>)
|
|
const re = /^\s*at (.*)\((.*):(\d+)\)$/
|
|
|
|
export function parseStackTraceElement(stackTraceLine: string): StackTraceElement | undefined {
|
|
const match = stackTraceLine.match(re)
|
|
if (match !== null) {
|
|
const [_, tracePath, fileName, lineStr] = match
|
|
return {
|
|
tracePath,
|
|
fileName,
|
|
lineStr
|
|
}
|
|
}
|
|
return undefined
|
|
}
|