1import { spawnPromisified } from '../common/index.mjs'; 2import { fileURL } from '../common/fixtures.mjs'; 3import { match, strictEqual } from 'node:assert'; 4import { execPath } from 'node:process'; 5import { describe, it } from 'node:test'; 6 7 8describe('ESM: non-js extensions fail', { concurrency: true }, () => { 9 it(async () => { 10 const { code, stderr, signal } = await spawnPromisified(execPath, [ 11 '--input-type=module', 12 '--eval', 13 `import ${JSON.stringify(fileURL('es-modules', 'file.unknown'))}`, 14 ]); 15 16 match(stderr, /ERR_UNKNOWN_FILE_EXTENSION/); 17 strictEqual(code, 1); 18 strictEqual(signal, null); 19 }); 20}); 21