2022-07-29 10:42:55 +02:00
|
|
|
import { spawnPromisified } from '../common/index.mjs';
|
2026-01-02 00:48:26 +01:00
|
|
|
import * as fixtures from '../common/fixtures.mjs';
|
2025-10-25 23:05:02 +02:00
|
|
|
import assert from 'node:assert';
|
2022-07-29 10:42:55 +02:00
|
|
|
import { execPath } from 'node:process';
|
|
|
|
|
import { describe, it } from 'node:test';
|
2022-01-06 03:07:52 -08:00
|
|
|
|
|
|
|
|
|
2024-03-23 22:11:28 +01:00
|
|
|
describe('ESM: loader with syntax error', { concurrency: !process.env.TEST_PARALLEL }, () => {
|
2022-07-29 10:42:55 +02:00
|
|
|
it('should crash the node process', async () => {
|
|
|
|
|
const { code, stderr } = await spawnPromisified(execPath, [
|
|
|
|
|
'--experimental-loader',
|
2026-01-02 00:48:26 +01:00
|
|
|
fixtures.fileURL('es-module-loaders', 'syntax-error.mjs').href,
|
|
|
|
|
fixtures.path('print-error-message.js'),
|
2022-07-29 10:42:55 +02:00
|
|
|
]);
|
2022-01-06 03:07:52 -08:00
|
|
|
|
2025-10-25 23:05:02 +02:00
|
|
|
assert.match(stderr, /SyntaxError/);
|
|
|
|
|
assert.ok(!stderr.includes('Bad command or file name'));
|
|
|
|
|
assert.notStrictEqual(code, 0);
|
2022-07-29 10:42:55 +02:00
|
|
|
});
|
|
|
|
|
});
|