metaltest/lib/stackparser.js

14 lines
379 B
JavaScript

const regAssertParser = /(.*?)\n+(.*?)\n+(( at.*?file:\/\/(.*?):(\d+):(\d+).*?\)).*)/s
const stackParser = (stack) => {
const m = stack.match(regAssertParser)
const info = m
.slice(1)
.map(x => x.trim())
const [title, diff, stacktrace, where, file, line, column] = info
return { title, diff, where, file, line, column, stacktrace }
}
export { stackParser }