11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ciconst { mustCall } = require('../common'); 41cb0ef41Sopenharmony_ciconst fixtures = require('../common/fixtures'); 51cb0ef41Sopenharmony_ciconst assert = require('node:assert'); 61cb0ef41Sopenharmony_ciconst { spawn } = require('node:child_process'); 71cb0ef41Sopenharmony_ciconst { execPath } = require('node:process'); 81cb0ef41Sopenharmony_ciconst { describe, it } = require('node:test'); 91cb0ef41Sopenharmony_ci 101cb0ef41Sopenharmony_ci 111cb0ef41Sopenharmony_cidescribe('ESM: REPL runs', { concurrency: true }, () => { 121cb0ef41Sopenharmony_ci it((t, done) => { 131cb0ef41Sopenharmony_ci const child = spawn(execPath, [ 141cb0ef41Sopenharmony_ci '--interactive', 151cb0ef41Sopenharmony_ci ], { 161cb0ef41Sopenharmony_ci cwd: fixtures.path('es-modules', 'pkgimports'), 171cb0ef41Sopenharmony_ci }); 181cb0ef41Sopenharmony_ci 191cb0ef41Sopenharmony_ci child.stdin.end( 201cb0ef41Sopenharmony_ci 'try{require("#test");await import("#test")}catch{process.exit(-1)}' 211cb0ef41Sopenharmony_ci ); 221cb0ef41Sopenharmony_ci 231cb0ef41Sopenharmony_ci child.on('exit', mustCall((code) => { 241cb0ef41Sopenharmony_ci assert.strictEqual(code, 0); 251cb0ef41Sopenharmony_ci done(); 261cb0ef41Sopenharmony_ci })); 271cb0ef41Sopenharmony_ci }); 281cb0ef41Sopenharmony_ci}); 29