Skip to content

Commit

Permalink
generate symlink in tmpdir
Browse files Browse the repository at this point in the history
  • Loading branch information
guybedford committed Mar 31, 2018
1 parent 2b69e65 commit 053cf5d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
16 changes: 14 additions & 2 deletions test/es-module/test-esm-symlink-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,22 @@

const assert = require('assert');
const path = require('path');
const entry = path.resolve(__dirname, '../fixtures/es-modules/symlink.js');
const { spawn } = require('child_process');
const tmpdir = require('../common/tmpdir');
const fs = require('fs');
tmpdir.refresh();

spawn(process.execPath, ['--experimental-modules', '--preserve-symlinks', entry],
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);
});
1 change: 0 additions & 1 deletion test/fixtures/es-modules/symlink.js

This file was deleted.

0 comments on commit 053cf5d

Please sign in to comment.