diff --git a/test/parallel/test-require-symlink.js b/test/parallel/test-require-symlink.js index d72805436a..38139ef1cf 100644 --- a/test/parallel/test-require-symlink.js +++ b/test/parallel/test-require-symlink.js @@ -7,6 +7,8 @@ const fs = require('fs'); const exec = require('child_process').exec; const spawn = require('child_process').spawn; +common.refreshTmpDir(); + const linkTarget = path.join(common.fixturesDir, '/module-require-symlink/node_modules/dep2/'); @@ -22,8 +24,8 @@ if (common.isWindows) { // On Windows, creating symlinks requires admin privileges. // We'll only try to run symlink test if we have enough privileges. exec('whoami /priv', function(err, o) { - if (err || o.indexOf('SeCreateSymbolicLinkPrivilege') == -1) { - console.log('Skipped: insufficient privileges'); + if (err || !o.includes('SeCreateSymbolicLinkPrivilege')) { + common.skip('insufficient privileges'); return; } else { test(); @@ -36,21 +38,20 @@ if (common.isWindows) { function test() { process.on('exit', function() { fs.unlinkSync(linkDir); - fs.unlinkSync(linkScript); }); fs.symlinkSync(linkTarget, linkDir); fs.symlinkSync(linkScriptTarget, linkScript); // load symlinked-module - var fooModule = + const fooModule = require(path.join(common.fixturesDir, '/module-require-symlink/foo.js')); - assert.equal(fooModule.dep1.bar.version, 'CORRECT_VERSION'); - assert.equal(fooModule.dep2.bar.version, 'CORRECT_VERSION'); + assert.strictEqual(fooModule.dep1.bar.version, 'CORRECT_VERSION'); + assert.strictEqual(fooModule.dep2.bar.version, 'CORRECT_VERSION'); // load symlinked-script as main - var node = process.execPath; - var child = spawn(node, ['--preserve-symlinks', linkScript]); + const node = process.execPath; + const child = spawn(node, ['--preserve-symlinks', linkScript]); child.on('close', function(code, signal) { assert(!code); assert(!signal);