mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
22 lines
523 B
TypeScript
22 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
|
|
}
|