1'use strict'; 2const common = require('../common'); 3 4// This test is only relevant on Windows. 5if (!common.isWindows) 6 common.skip('Windows specific test.'); 7 8// This test ensures fs.realpathSync works on properly on Windows without 9// throwing ENOENT when the path involves a fileserver. 10// https://github.com/nodejs/node-v0.x-archive/issues/3542 11 12const assert = require('assert'); 13const fs = require('fs'); 14const os = require('os'); 15const path = require('path'); 16 17function test(p) { 18 const result = fs.realpathSync(p); 19 assert.strictEqual(result.toLowerCase(), path.resolve(p).toLowerCase()); 20 21 fs.realpath(p, common.mustCall(function(err, result) { 22 assert.ok(!err); 23 assert.strictEqual(result.toLowerCase(), path.resolve(p).toLowerCase()); 24 })); 25} 26 27test(`//${os.hostname()}/c$/Windows/System32`); 28test(`//${os.hostname()}/c$/Windows`); 29test(`//${os.hostname()}/c$/`); 30test(`\\\\${os.hostname()}\\c$\\`); 31test('C:\\'); 32test('C:'); 33test(process.env.windir); 34