Skip to content

Commit

Permalink
fix: ensurance in codeframe reporter
Browse files Browse the repository at this point in the history
Signed-off-by: Charlike Mike Reagent <olsten.larck@gmail.com>
  • Loading branch information
Charlike Mike Reagent committed Jul 19, 2018
1 parent 9c06f43 commit b7fd47f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "asia",
"version": "0.19.0",
"version": "0.19.1",
"description": "Blazingly fast, magical and minimalist testing framework, for Today and Tomorrow",
"repository": "olstenlarck/asia",
"author": "Charlike Mike Reagent",
Expand Down
25 changes: 16 additions & 9 deletions src/reporters/codeframe.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,26 @@ module.exports = function codeframeReporter({ ansi, utils, parsedArgv }) {
content: meta.content,
err: test.reason,
});
const [, at, filepath] = /at (.+) \((.+)\)/.exec(atLine);

console.log(
`${ansi.red('fail')}:`,
ansi.bold(test.title),
ansi.dim(`(${at})`),
'at',
`${ansi.green(getRelativePath(filepath))}:`,
);

if (ok) {
const [, at, filepath] = /at (.+) \((.+)\)/.exec(atLine);

console.log(
`${ansi.red('fail')}:`,
ansi.bold(test.title),
ansi.dim(`(${at})`),
'at',
`${ansi.green(getRelativePath(filepath))}:`,
);
console.log(sourceFrame);
} else {
console.log(
`${ansi.red('fail')}:`,
ansi.bold(test.title),
ansi.dim(`(null)`),
'at',
`${ansi.green(getRelativePath(meta.filename))}:`,
);
console.log(ansi.red(test.reason.stack));
}
} else if (test.isFulfilled && parsedArgv.min === false) {
Expand Down

0 comments on commit b7fd47f

Please sign in to comment.