From 855f46677c1ff46c2d5217cf03ea8015f07a8040 Mon Sep 17 00:00:00 2001 From: Nathan Rajlich Date: Sun, 18 Dec 2011 13:33:48 -0800 Subject: [PATCH] test: Add test case for MODULE_NOT_FOUND. --- test/simple/test-require-exceptions.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/simple/test-require-exceptions.js b/test/simple/test-require-exceptions.js index 16280016db1..41f130acc8f 100644 --- a/test/simple/test-require-exceptions.js +++ b/test/simple/test-require-exceptions.js @@ -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; +});