Permalink
Browse files

Failing test case for pkg.main pointing to a directory.

  • Loading branch information...
1 parent 2dcc3cb commit b57a75aefc394ead20d54ed107741f1f7151b90f @jaredhanson jaredhanson committed with Jul 29, 2013
View
@@ -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) {
@@ -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');
@@ -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');
@@ -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) {
Oops, something went wrong.
Oops, something went wrong.

0 comments on commit b57a75a

Please sign in to comment.