1'use strict';
2
3const { mustCall } = require('../common');
4const fixtures = require('../common/fixtures');
5const assert = require('node:assert');
6const { spawn } = require('node:child_process');
7const { execPath } = require('node:process');
8const { describe, it } = require('node:test');
9
10
11describe('ESM: REPL runs', { concurrency: true }, () => {
12  it((t, done) => {
13    const child = spawn(execPath, [
14      '--interactive',
15    ], {
16      cwd: fixtures.path('es-modules', 'pkgimports'),
17    });
18
19    child.stdin.end(
20      'try{require("#test");await import("#test")}catch{process.exit(-1)}'
21    );
22
23    child.on('exit', mustCall((code) => {
24      assert.strictEqual(code, 0);
25      done();
26    }));
27  });
28});
29