From e0113ab5e0e2b329668fa7d744fac3bfe8b95935 Mon Sep 17 00:00:00 2001 From: Cyril Lakech <1169286+clakech@users.noreply.github.com> Date: Mon, 6 Nov 2017 10:34:28 +0000 Subject: [PATCH] loader: test search module PR-URL: https://github.com/nodejs/node/pull/16795 Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Anatoli Papirovski Reviewed-By: Gireesh Punathil Reviewed-By: Luigi Pinca --- test/es-module/test-esm-loader-search.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 test/es-module/test-esm-loader-search.js diff --git a/test/es-module/test-esm-loader-search.js b/test/es-module/test-esm-loader-search.js new file mode 100644 index 00000000000000..c8c24f1deb80ae --- /dev/null +++ b/test/es-module/test-esm-loader-search.js @@ -0,0 +1,18 @@ +'use strict'; +// Flags: --expose-internals + +// This test ensures that search throws errors appropriately + +const common = require('../common'); + +const search = require('internal/loader/search'); +const errors = require('internal/errors'); + +common.expectsError( + () => search('target', undefined), + { + code: 'ERR_MISSING_MODULE', + type: errors.Error, + message: 'Cannot find module target' + } +);