2022-06-30 08:31:02 +00:00
|
|
|
'use strict';
|
2022-07-29 08:42:55 +00:00
|
|
|
|
2022-06-30 08:31:02 +00:00
|
|
|
const { mustCall } = require('../common');
|
|
|
|
const fixtures = require('../common/fixtures');
|
2022-07-29 08:42:55 +00:00
|
|
|
const assert = require('node:assert');
|
|
|
|
const { spawn } = require('node:child_process');
|
|
|
|
const { execPath } = require('node:process');
|
|
|
|
const { describe, it } = require('node:test');
|
2022-06-30 08:31:02 +00:00
|
|
|
|
|
|
|
|
2024-03-23 21:11:28 +00:00
|
|
|
describe('ESM: REPL runs', { concurrency: !process.env.TEST_PARALLEL }, () => {
|
2023-02-28 19:58:49 +00:00
|
|
|
it((t, done) => {
|
2022-07-29 08:42:55 +00:00
|
|
|
const child = spawn(execPath, [
|
|
|
|
'--interactive',
|
|
|
|
], {
|
|
|
|
cwd: fixtures.path('es-modules', 'pkgimports'),
|
|
|
|
});
|
2022-06-30 08:31:02 +00:00
|
|
|
|
2022-07-29 08:42:55 +00:00
|
|
|
child.stdin.end(
|
|
|
|
'try{require("#test");await import("#test")}catch{process.exit(-1)}'
|
|
|
|
);
|
|
|
|
|
|
|
|
child.on('exit', mustCall((code) => {
|
|
|
|
assert.strictEqual(code, 0);
|
|
|
|
done();
|
|
|
|
}));
|
|
|
|
});
|
|
|
|
});
|