Files
node/test/es-module/test-esm-syntax-error.mjs
2022-01-06 11:07:52 +00:00

20 lines
527 B
JavaScript

import { mustCall } from '../common/index.mjs';
import { path } from '../common/fixtures.mjs';
import { match, notStrictEqual } from 'assert';
import { spawn } from 'child_process';
import { execPath } from 'process';
const child = spawn(execPath, [
path('es-module-loaders', 'syntax-error.mjs'),
]);
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:/);
}));