|
1 | 1 | // This tests that cpSync copies link if it does not point to folder in src. |
2 | | -import { mustNotMutateObjectDeep } from '../common/index.mjs'; |
| 2 | +import { mustNotMutateObjectDeep, isWindows } from '../common/index.mjs'; |
3 | 3 | import { nextdir } from '../common/fs.js'; |
4 | 4 | import assert from 'node:assert'; |
5 | 5 | import { cpSync, mkdirSync, symlinkSync, readlinkSync } from 'node:fs'; |
@@ -16,4 +16,11 @@ mkdirSync(join(dest, 'a'), mustNotMutateObjectDeep({ recursive: true }));
|
16 | 16 | symlinkSync(dest, join(dest, 'a', 'c')); |
17 | 17 | cpSync(src, dest, mustNotMutateObjectDeep({ recursive: true })); |
18 | 18 | const link = readlinkSync(join(dest, 'a', 'c')); |
19 | | -assert.strictEqual(link, src); |
| 19 | + |
| 20 | +if (isWindows) { |
| 21 | +// On Windows, readlinkSync() may return a path with uppercase drive letter, |
| 22 | +// but paths are case-insensitive. |
| 23 | +assert.strictEqual(link.toLowerCase(), src.toLowerCase()); |
| 24 | +} else { |
| 25 | +assert.strictEqual(link, src); |
| 26 | +} |