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.mustSucceed((result) => { 22 assert.strictEqual(result.toLowerCase(), path.resolve(p).toLowerCase()); 23 })); 24} 25 26test(`//${os.hostname()}/c$/Windows/System32`); 27test(`//${os.hostname()}/c$/Windows`); 28test(`//${os.hostname()}/c$/`); 29test(`\\\\${os.hostname()}\\c$\\`); 30test('C:\\'); 31test('C:'); 32test(process.env.windir); 33