Better assert in the node_modules tests

pull/5370/head
isaacs 2011-02-09 13:52:29 -08:00 committed by Ryan Dahl
parent 46513483cd
commit 81b4d45354
2 changed files with 6 additions and 4 deletions

View File

@ -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'));

3
test/fixtures/node_modules/foo.js generated vendored
View File

@ -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'));