Skip to content

Commit

Permalink
Fix eslint problems and update count of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tcchau committed May 23, 2018
1 parent c86b277 commit d9d942e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
26 changes: 13 additions & 13 deletions test/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ var test = require('tape');
var resolve = require('../');

test('async foo', function (t) {
t.plan(10);
t.plan(11);
var dir = path.join(__dirname, 'resolver');

resolve('./foo', { basedir : dir }, function (err, res, pkg) {
resolve('./foo', { basedir: dir }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, path.join(dir, 'foo.js'));
t.equal(pkg && pkg.name, 'resolve');
Expand Down Expand Up @@ -36,7 +36,7 @@ test('async foo', function (t) {
});

// Test that filename is reported as the "from" value when passed.
resolve('foo', { basedir : dir, filename : path.join(dir, 'baz.js') }, function (err) {
resolve('foo', { basedir: dir, filename: path.join(dir, 'baz.js') }, function (err) {
t.equal(err.message, "Cannot find module 'foo' from '" + path.join(dir, 'baz.js') + "'");
});
});
Expand Down Expand Up @@ -181,14 +181,14 @@ test('normalize', function (t) {
});

test('cup', function (t) {
t.plan(4);
t.plan(5);
var dir = path.join(__dirname, 'resolver');

resolve('./cup', { basedir : dir, extensions : [ '.js', '.coffee' ] },
function (err, res) {
if (err) t.fail(err);
t.equal(res, path.join(dir, 'cup.coffee'));
});
resolve('./cup', { basedir: dir, extensions: ['.js', '.coffee'] },
function (err, res) {
if (err) t.fail(err);
t.equal(res, path.join(dir, 'cup.coffee'));
});

resolve('./cup.coffee', { basedir: dir }, function (err, res) {
if (err) t.fail(err);
Expand All @@ -201,10 +201,10 @@ test('cup', function (t) {
});

// Test that filename is reported as the "from" value when passed.
resolve('./cup', { basedir : dir, extensions : [ '.js' ], filename : path.join(dir, 'cupboard.js') },
function (err, res) {
t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'");
});
resolve('./cup', { basedir: dir, extensions: ['.js'], filename: path.join(dir, 'cupboard.js') },
function (err, res) {
t.equal(err.message, "Cannot find module './cup' from '" + path.join(dir, 'cupboard.js') + "'");
});
});

test('mug', function (t) {
Expand Down
9 changes: 4 additions & 5 deletions test/resolver_sync.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
var path = require('path');
var test = require('tape');
var resolve = require('../');
var path = require('path');

test('foo', function (t) {
var dir = path.join(__dirname, 'resolver');
Expand All @@ -23,12 +22,12 @@ test('foo', function (t) {
// Test that filename is reported as the "from" value when passed.
t.throws(
function () {
resolve.sync('foo', { basedir : dir, filename : path.join(dir, 'bar.js') });
resolve.sync('foo', { basedir: dir, filename: path.join(dir, 'bar.js') });
},
{
name : 'Error',
message : "Cannot find module 'foo' from '" +
path.join(dir, 'bar.js') + "'"
name: 'Error',
message: "Cannot find module 'foo' from '"
+ path.join(dir, 'bar.js') + "'"
}
);

Expand Down

0 comments on commit d9d942e

Please sign in to comment.