• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1import { spawnPromisified } from '../common/index.mjs';
2import * as fixtures from '../common/fixtures.mjs';
3import assert from 'node:assert';
4import { execPath } from 'node:process';
5import { describe, it } from 'node:test';
6
7
8describe('ESM: named JSON exports', { concurrency: true }, () => {
9  it('should throw, citing named import', async () => {
10    const { code, stderr } = await spawnPromisified(execPath, [
11      fixtures.path('es-modules', 'import-json-named-export.mjs'),
12    ]);
13
14    // SyntaxError: The requested module '../experimental.json'
15    // does not provide an export named 'ofLife'
16    assert.match(stderr, /SyntaxError:/);
17    assert.match(stderr, /'\.\.\/experimental\.json'/);
18    assert.match(stderr, /'ofLife'/);
19
20    assert.notStrictEqual(code, 0);
21  });
22});
23