• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import { spawnPromisified } from '../common/index.mjs';
2import { fileURL, path } from '../common/fixtures.mjs';
3import { match, ok, notStrictEqual } from 'node:assert';
4import { execPath } from 'node:process';
5import { describe, it } from 'node:test';
6
7
8describe('ESM: loader with syntax error', { concurrency: true }, () => {
9  it('should crash the node process', async () => {
10    const { code, stderr } = await spawnPromisified(execPath, [
11      '--experimental-loader',
12      fileURL('es-module-loaders', 'syntax-error.mjs').href,
13      path('print-error-message.js'),
14    ]);
15
16    match(stderr, /SyntaxError \[Error\]:/);
17    ok(!stderr.includes('Bad command or file name'));
18    notStrictEqual(code, 0);
19  });
20});
21