From 1eef742ad707f1d44082681fefb21c4d6950232f Mon Sep 17 00:00:00 2001 From: Ray Date: Fri, 17 Jun 2022 19:13:07 +0800 Subject: [PATCH] test: add test for repl subpath imports --- test/es-module/test-esm-repl-imports.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/es-module/test-esm-repl-imports.js diff --git a/test/es-module/test-esm-repl-imports.js b/test/es-module/test-esm-repl-imports.js new file mode 100644 index 00000000000000..f4b53567bc9cfd --- /dev/null +++ b/test/es-module/test-esm-repl-imports.js @@ -0,0 +1,19 @@ +'use strict'; +require('../common'); +const assert = require('assert'); +const { spawn } = require('child_process'); + +const child = spawn(process.execPath, [ + '--interactive', +], { + cwd: __dirname + '/../fixtures/es-modules/pkgimports', +}); + +child.stdin.end(` +try { require('#test'); process.exit(0); } +catch (e) { process.exit(-1); } +`); + +child.on('exit', (code) => { + assert.strictEqual(code, 0); +});