From 81b4d4535472533e9e3919f5460ab2b0967ea4b1 Mon Sep 17 00:00:00 2001 From: isaacs Date: Wed, 9 Feb 2011 13:52:29 -0800 Subject: [PATCH] Better assert in the node_modules tests --- test/fixtures/node_modules/baz/index.js | 7 ++++--- test/fixtures/node_modules/foo.js | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/test/fixtures/node_modules/baz/index.js b/test/fixtures/node_modules/baz/index.js index be18439e61..ae2351d276 100644 --- a/test/fixtures/node_modules/baz/index.js +++ b/test/fixtures/node_modules/baz/index.js @@ -1,13 +1,14 @@ console.error(__filename); console.error(module.paths.join('\n')+'\n'); // this should work, and get the one that doesn't throw -require('bar'); +var assert = require('assert'); +assert.equal(require('bar'), require('../bar.js')); // since this is inside a node_modules folder, // it should be impossible to ever see /node_modules in the // lookup paths, since it's rooted on the uppermost node_modules // directory. -require('assert').equal(-1, module.paths.indexOf('/node_modules')); +assert.equal(-1, module.paths.indexOf('/node_modules')); // this should work, and get the one in ./node_modules/asdf.js -require('asdf'); +assert.equal(require('asdf'), require('./node_modules/asdf.js')); diff --git a/test/fixtures/node_modules/foo.js b/test/fixtures/node_modules/foo.js index 90ab0f3609..d8114a7139 100644 --- a/test/fixtures/node_modules/foo.js +++ b/test/fixtures/node_modules/foo.js @@ -1,3 +1,4 @@ console.error(__filename); console.error(module.paths.join('\n')+'\n'); -require('baz'); +var assert = require('assert'); +assert.equal(require('baz'), require('./baz/index.js'));