test: Add test case for MODULE_NOT_FOUND.

v0.7.4-release
Nathan Rajlich 2011-12-18 13:33:48 -08:00 committed by koichik
parent ec11525d33
commit 855f46677c
1 changed files with 9 additions and 0 deletions

View File

@ -31,3 +31,12 @@ assert.throws(function() {
assert.throws(function() {
require(common.fixturesDir + '/throws_error');
});
// Requiring a module that does not exist should throw an
// error with its `code` set to MODULE_NOT_FOUND
assert.throws(function () {
require(common.fixturesDir + '/DOES_NOT_EXIST');
}, function (e) {
assert.equal('MODULE_NOT_FOUND', e.code);
return true;
});