summaryrefslogtreecommitdiff
path: root/test/es-module/test-esm-symlink-main.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/es-module/test-esm-symlink-main.js')
-rw-r--r--test/es-module/test-esm-symlink-main.js25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/es-module/test-esm-symlink-main.js b/test/es-module/test-esm-symlink-main.js
new file mode 100644
index 0000000000..f7631ef2e5
--- /dev/null
+++ b/test/es-module/test-esm-symlink-main.js
@@ -0,0 +1,25 @@
+'use strict';
+
+const common = require('../common');
+const assert = require('assert');
+const path = require('path');
+const { spawn } = require('child_process');
+const tmpdir = require('../common/tmpdir');
+const fs = require('fs');
+tmpdir.refresh();
+
+const realPath = path.resolve(__dirname, '../fixtures/es-modules/symlink.mjs');
+const symlinkPath = path.resolve(tmpdir.path, 'symlink.js');
+
+try {
+ fs.symlinkSync(realPath, symlinkPath);
+} catch (err) {
+ if (err.code !== 'EPERM') throw err;
+ common.skip('insufficient privileges for symlinks');
+}
+
+spawn(process.execPath,
+ ['--experimental-modules', '--preserve-symlinks', symlinkPath],
+ { stdio: 'inherit' }).on('exit', (code) => {
+ assert.strictEqual(code, 0);
+});