metaltest/lib/stackparser.js

14 lines
379 B
JavaScript
Raw Normal View History

2022-12-06 12:58:30 -05:00
const regAssertParser = /(.*?)\n+(.*?)\n+(( at.*?file:\/\/(.*?):(\d+):(\d+).*?\)).*)/s
2022-12-04 23:40:07 -05:00
2022-12-06 12:58:30 -05:00
const stackParser = (stack) => {
const m = stack.match(regAssertParser)
2022-12-04 23:40:07 -05:00
2022-12-06 12:58:30 -05:00
const info = m
.slice(1)
.map(x => x.trim())
const [title, diff, stacktrace, where, file, line, column] = info
2022-12-04 23:40:07 -05:00
2022-12-06 12:58:30 -05:00
return { title, diff, where, file, line, column, stacktrace }
2022-12-04 23:40:07 -05:00
}
export { stackParser }