Skip to content

Commit

Permalink
Failing test case for pkg.main pointing to a directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredhanson authored and James Halliday committed Aug 3, 2013
1 parent 2dcc3cb commit b57a75a
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
38 changes: 37 additions & 1 deletion test/resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ test('baz', function (t) {
});

test('biz', function (t) {
t.plan(12);
t.plan(24);
var dir = __dirname + '/resolver/biz/node_modules';

resolve('./grux', { basedir : dir }, function (err, res, pkg) {
Expand All @@ -90,6 +90,18 @@ test('biz', function (t) {
t.equal(pkg.main, 'biz');
});

resolve('./garply', { basedir : dir }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/garply/lib/index.js');
t.equal(pkg.main, './lib');
});

resolve('./garply', { basedir : dir, package: { main: 'biz' } }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/garply/lib/index.js');
t.equal(pkg.main, './lib');
});

resolve('tiv', { basedir : dir + '/grux' }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/tiv/index.js');
Expand All @@ -102,6 +114,18 @@ test('biz', function (t) {
t.equal(pkg, undefined);
});

resolve('tiv', { basedir : dir + '/garply' }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/tiv/index.js');
t.equal(pkg, undefined);
});

resolve('tiv', { basedir : dir + '/garply', package: { main: './lib' } }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/tiv/index.js');
t.equal(pkg, undefined);
});

resolve('grux', { basedir : dir + '/tiv' }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/grux/index.js');
Expand All @@ -113,6 +137,18 @@ test('biz', function (t) {
t.equal(res, dir + '/grux/index.js');
t.equal(pkg, undefined);
});

resolve('garply', { basedir : dir + '/tiv' }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/garply/lib/index.js');
t.equal(pkg.main, './lib');
});

resolve('garply', { basedir : dir + '/tiv', package: { main: 'tiv' } }, function (err, res, pkg) {
if (err) t.fail(err);
t.equal(res, dir + '/garply/lib/index.js');
t.equal(pkg.main, './lib');
});
});

test('quux', function (t) {
Expand Down
1 change: 1 addition & 0 deletions test/resolver/biz/node_modules/garply/lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions test/resolver/biz/node_modules/garply/package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b57a75a

Please sign in to comment.