11cb0ef41Sopenharmony_ciimport { spawnPromisified } from '../common/index.mjs';
21cb0ef41Sopenharmony_ciimport { fileURL, path } from '../common/fixtures.mjs';
31cb0ef41Sopenharmony_ciimport { match, ok, notStrictEqual } from 'node:assert';
41cb0ef41Sopenharmony_ciimport { execPath } from 'node:process';
51cb0ef41Sopenharmony_ciimport { describe, it } from 'node:test';
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_cidescribe('ESM: loader with syntax error', { concurrency: true }, () => {
91cb0ef41Sopenharmony_ci  it('should crash the node process', async () => {
101cb0ef41Sopenharmony_ci    const { code, stderr } = await spawnPromisified(execPath, [
111cb0ef41Sopenharmony_ci      '--experimental-loader',
121cb0ef41Sopenharmony_ci      fileURL('es-module-loaders', 'syntax-error.mjs').href,
131cb0ef41Sopenharmony_ci      path('print-error-message.js'),
141cb0ef41Sopenharmony_ci    ]);
151cb0ef41Sopenharmony_ci
161cb0ef41Sopenharmony_ci    match(stderr, /SyntaxError \[Error\]:/);
171cb0ef41Sopenharmony_ci    ok(!stderr.includes('Bad command or file name'));
181cb0ef41Sopenharmony_ci    notStrictEqual(code, 0);
191cb0ef41Sopenharmony_ci  });
201cb0ef41Sopenharmony_ci});
21