From 34861efff6cc4c566b563861147667d9663c3e90 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 0000000000..45272cf5c3 --- /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'; +});