summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/simple/test-require-exceptions.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/simple/test-require-exceptions.js b/test/simple/test-require-exceptions.js
index 16280016db..41f130acc8 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;
+});