diff --git a/lib/internal/errors.js b/lib/internal/errors.js index dbc10e6e0739c1..94088aac108843 100644 --- a/lib/internal/errors.js +++ b/lib/internal/errors.js @@ -1415,8 +1415,7 @@ E('ERR_WORKER_PATH', (filename) => 'The worker script or module filename must be an absolute path or a ' + 'relative path starting with \'./\' or \'../\'.' + (filename.startsWith('file://') ? - ' If you want to pass a file:// URL, you must wrap it around `new URL`.' : - '' + ' Wrap file:// URLs with `new URL`.' : '' ) + ` Received "${filename}"`, TypeError); diff --git a/test/parallel/test-worker-unsupported-path.js b/test/parallel/test-worker-unsupported-path.js index e9cd6a32ec7cb9..1a5f53c821ee6c 100644 --- a/test/parallel/test-worker-unsupported-path.js +++ b/test/parallel/test-worker-unsupported-path.js @@ -31,12 +31,12 @@ const { Worker } = require('worker_threads'); { assert.throws( () => { new Worker('file:///file_url'); }, - /If you want to pass a file:\/\/ URL, you must wrap it around `new URL`/ + /Wrap file:\/\/ URLs with `new URL`/ ); assert.throws( () => { new Worker('relative_no_dot'); }, // eslint-disable-next-line node-core/no-unescaped-regexp-dot - /^((?!If you want to pass a file:\/\/ URL, you must wrap it around `new URL`).)*$/s + /^((?!Wrap file:\/\/ URLs with `new URL`).)*$/s ); }