diff --git a/lib/internal/modules/cjs/loader.js b/lib/internal/modules/cjs/loader.js index 332767b3ab225b..b101f23dbe1321 100644 --- a/lib/internal/modules/cjs/loader.js +++ b/lib/internal/modules/cjs/loader.js @@ -853,7 +853,7 @@ function createRequireFromPath(filename) { Module.createRequireFromPath = createRequireFromPath; -const createRequireError = 'must be a file URL object, file URL string, or' + +const createRequireError = 'must be a file URL object, file URL string, or ' + 'absolute path string'; function createRequire(filename) { diff --git a/test/parallel/test-module-create-require.js b/test/parallel/test-module-create-require.js index fa25b87f95921b..fc7c8b3fc697ea 100644 --- a/test/parallel/test-module-create-require.js +++ b/test/parallel/test-module-create-require.js @@ -30,5 +30,7 @@ assert.throws(() => { assert.throws(() => { createRequire({}); }, { - code: 'ERR_INVALID_ARG_VALUE' + code: 'ERR_INVALID_ARG_VALUE', + message: 'The argument \'filename\' must be a file URL object, file URL ' + + 'string, or absolute path string. Received {}' });