Show at for all test

master
Frédéric Matte 2025-06-02 18:56:57 -04:00
parent b9a01eed3f
commit 1b53b9854b
3 changed files with 14 additions and 7 deletions

View File

@ -40,11 +40,11 @@ const metaltest = (title) => {
}
const runner = (name, fn) => {
suite.push({ name, fn })
suite.push({ name, fn, at: getAt() })
}
runner.only = (name, fn) => { only.push({ name, fn }) }
runner.skip = (name, fn) => { skipped.push({ name, fn }) }
runner.only = (name, fn) => { only.push({ name, fn, at: getAt() }) }
runner.skip = (name, fn) => { skipped.push({ name, fn, at: getAt() }) }
runner.before = (fn) => { before.push(fn) }
runner.after = (fn) => { after.push(fn) }
runner.end = (name, fn) => { end.push({ name, fn }) }

View File

@ -1,9 +1,13 @@
const regAssertParser = /(?<title>.*?)\n+(?<diff>.*?)\n+(?<stacktrace> (?<where>at.*?file:\/\/(?<file>.*?):(?<line>\d+):(?<column>\d+)\)?)\n.*)/s
const regStack = /(?<=^ )at.*/gm
const stackParser = (stack) => {
const m = stack.match(regAssertParser)
return m.groups
const stacks = stack.match(regStack)
return { ...m.groups, stacks }
}
export { stackParser }

View File

@ -23,8 +23,11 @@ const prettyError = (test) => {
if (stack.diff != '')
log(chalk.white(stack.diff) + '\n')
if (stack.where != '')
log(chalk.gray(stack.where) + '\n')
// if (stack.where != '')
// log(chalk.gray(stack.where) + '\n')
log(chalk.gray(test.at.summary) + '\n')
log(chalk.gray(stack.stacks.join('\n')) + '\n')
}
export { showError }