diff options
Diffstat (limited to 'test/es-module/test-esm-loader-with-syntax-error.mjs')
-rw-r--r-- | test/es-module/test-esm-loader-with-syntax-error.mjs | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/es-module/test-esm-loader-with-syntax-error.mjs b/test/es-module/test-esm-loader-with-syntax-error.mjs new file mode 100644 index 0000000000..d973e72975 --- /dev/null +++ b/test/es-module/test-esm-loader-with-syntax-error.mjs @@ -0,0 +1,24 @@ +import { mustCall } from '../common/index.mjs'; +import { fileURL, path } from '../common/fixtures.mjs'; +import { match, ok, notStrictEqual } from 'assert'; +import { spawn } from 'child_process'; +import { execPath } from 'process'; + +const child = spawn(execPath, [ + '--experimental-loader', + fileURL('es-module-loaders', 'syntax-error.mjs').href, + path('print-error-message.js'), +]); + +let stderr = ''; +child.stderr.setEncoding('utf8'); +child.stderr.on('data', (data) => { + stderr += data; +}); +child.on('close', mustCall((code, _signal) => { + notStrictEqual(code, 0); + + match(stderr, /SyntaxError:/); + + ok(!stderr.includes('Bad command or file name')); +})); |