Skip to content

Commit f839d20

Browse files
committed
[Tests] better failure messages
1 parent 4b2b392 commit f839d20

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

test/node_path.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ var test = require('tape');
33
var resolve = require('../');
44

55
test('$NODE_PATH', function (t) {
6-
t.plan(4);
6+
t.plan(8);
77

88
resolve('aaa', {
99
paths: [
@@ -12,7 +12,8 @@ test('$NODE_PATH', function (t) {
1212
],
1313
basedir: __dirname
1414
}, function (err, res) {
15-
t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'));
15+
t.error(err);
16+
t.equal(res, path.join(__dirname, '/node_path/x/aaa/index.js'), 'aaa resolves');
1617
});
1718

1819
resolve('bbb', {
@@ -22,7 +23,8 @@ test('$NODE_PATH', function (t) {
2223
],
2324
basedir: __dirname
2425
}, function (err, res) {
25-
t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'));
26+
t.error(err);
27+
t.equal(res, path.join(__dirname, '/node_path/y/bbb/index.js'), 'bbb resolves');
2628
});
2729

2830
resolve('ccc', {
@@ -32,7 +34,8 @@ test('$NODE_PATH', function (t) {
3234
],
3335
basedir: __dirname
3436
}, function (err, res) {
35-
t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'));
37+
t.error(err);
38+
t.equal(res, path.join(__dirname, '/node_path/x/ccc/index.js'), 'ccc resolves');
3639
});
3740

3841
/*
@@ -46,6 +49,7 @@ test('$NODE_PATH', function (t) {
4649
basedir: 'node_path/x'
4750
}, function (err, res) {
4851
var root = require('tap/package.json').main;
49-
t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root));
52+
t.error(err);
53+
t.equal(res, path.resolve(__dirname, '..', 'node_modules/tap', root), 'tap resolves');
5054
});
5155
});

test/symlinks.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ try {
1515
}
1616

1717
test('symlink', function (t) {
18-
t.plan(1);
18+
t.plan(2);
1919

2020
resolve('foo', { basedir: symlinkDir, preserveSymlinks: false }, function (err, res, pkg) {
21-
if (err) t.fail(err);
21+
t.error(err);
2222
t.equal(res, path.join(__dirname, 'resolver', 'symlinked', '_', 'node_modules', 'foo.js'));
2323
});
2424
});

0 commit comments

Comments
 (0)