Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/reporters/mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,10 @@ class MiniReporter {
if (test.error.source) {
status += ' ' + colors.errorSource(test.error.source.file + ':' + test.error.source.line) + '\n';

const errorPath = path.join(this.options.basePath, test.error.source.file);
let errorPath = test.error.source.file;
if (!path.isAbsolute(test.error.source.file)) {
errorPath = path.join(this.options.basePath, test.error.source.file);
}
const excerpt = codeExcerpt(errorPath, test.error.source.line, {maxWidth: process.stdout.columns});
if (excerpt) {
status += '\n' + indentString(excerpt, 2) + '\n';
Expand Down
5 changes: 4 additions & 1 deletion lib/reporters/verbose.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ class VerboseReporter {
if (test.error.source) {
output += ' ' + colors.errorSource(test.error.source.file + ':' + test.error.source.line) + '\n';

const errorPath = path.join(this.options.basePath, test.error.source.file);
let errorPath = test.error.source.file;
if (!path.isAbsolute(test.error.source.file)) {
errorPath = path.join(this.options.basePath, test.error.source.file);
}
const excerpt = codeExcerpt(errorPath, test.error.source.line, {maxWidth: process.stdout.columns});
if (excerpt) {
output += '\n' + indentString(excerpt, 2) + '\n';
Expand Down