Skip to content

Commit dbed3d4

Browse files
committed
relative file path and colors
1 parent 1f431c4 commit dbed3d4

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

lib/fork.js

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ if (env.NODE_PATH) {
2424
module.exports = function (file, opts) {
2525
opts = objectAssign({
2626
file: file,
27+
baseDir: process.cwd(),
2728
tty: process.stdout.isTTY ? {
2829
columns: process.stdout.columns,
2930
rows: process.stdout.rows

lib/test.js

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
'use strict';
2+
var path = require('path');
23
var inspect = require('util').inspect;
4+
var chalk = require('chalk');
35
var isGeneratorFn = require('is-generator-fn');
46
var maxTimeout = require('max-timeout');
57
var Promise = require('bluebird');
@@ -72,14 +74,15 @@ Test.prototype._setAssertError = function (err) {
7274
if (data) {
7375
console.error(
7476
[
75-
'Improper usage of t.throws detected at %s (%d:%d).',
77+
'Improper usage of t.throws detected at ' + chalk.bold.yellow('%s (%d:%d)') + '.',
7678
'You should wrap the following expression in a function:',
77-
' %s',
79+
chalk.cyan(' %s'),
7880
'Like this:',
79-
' function() {\n %s\n }',
80-
'See https://github.com/sindresorhus/ava#throwsfunctionpromise-error-message for more details.'
81+
chalk.cyan(' function() {\n %s\n }'),
82+
'Visit the following URL for more details:',
83+
' ' + chalk.blue.underline('https://github.com/sindresorhus/ava#throwsfunctionpromise-error-message')
8184
].join('\n\n'),
82-
data.filename,
85+
path.relative(globals.options.baseDir, data.filename),
8386
data.line,
8487
data.column,
8588
data.source,

0 commit comments

Comments
 (0)