@@ -15,7 +15,7 @@ const {
|
15 | 15 | writeFileSync, |
16 | 16 | } = fs; |
17 | 17 | import net from 'net'; |
18 | | -import { join } from 'path'; |
| 18 | +import { join, resolve } from 'path'; |
19 | 19 | import { pathToFileURL } from 'url'; |
20 | 20 | import { setTimeout } from 'timers/promises'; |
21 | 21 | |
@@ -248,6 +248,17 @@ function nextdir(dirname) {
|
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
| 251 | +// It allows copying when is not a directory |
| 252 | +{ |
| 253 | +const src = nextdir(); |
| 254 | +const dest = nextdir(); |
| 255 | +mkdirSync(src, mustNotMutateObjectDeep({ recursive: true })); |
| 256 | +writeFileSync(`${src}/test.txt`, 'test'); |
| 257 | +symlinkSync(resolve(`${src}/test.txt`), join(src, 'link.txt')); |
| 258 | +cpSync(src, dest, mustNotMutateObjectDeep({ recursive: true })); |
| 259 | +cpSync(src, dest, mustNotMutateObjectDeep({ recursive: true })); |
| 260 | +} |
| 261 | + |
251 | 262 | // It throws error if symlink in dest points to location in src. |
252 | 263 | { |
253 | 264 | const src = nextdir(); |
|