From 0f05173bede0fa91f7ba3fb21489857c2e62e4ef Mon Sep 17 00:00:00 2001 From: Duy Le Date: Wed, 21 Dec 2016 15:07:46 -0800 Subject: [PATCH] test: add test-require-invalid-package Add test for requiriing an invalid package path. PR-URL: https://github.com/nodejs/node/pull/9903 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Franziska Hinkelmann --- test/parallel/test-require-invalid-package.js | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 test/parallel/test-require-invalid-package.js diff --git a/test/parallel/test-require-invalid-package.js b/test/parallel/test-require-invalid-package.js new file mode 100644 index 00000000000000..45272cf5c3af9a --- /dev/null +++ b/test/parallel/test-require-invalid-package.js @@ -0,0 +1,9 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); + +// Should be an invalid package path. +assert.throws(() => require('package.json'), (err) => { + return err && err.code === 'MODULE_NOT_FOUND'; +});