@@ -248,7 +248,7 @@ function nextdir(dirname) {
|
248 | 248 | ); |
249 | 249 | } |
250 | 250 | |
251 | | -// It allows copying when is not a directory |
| 251 | +// It allows cpSync copying symlinks in src to locations in dest with existing synlinks not pointing to a directory. |
252 | 252 | { |
253 | 253 | const src = nextdir(); |
254 | 254 | const dest = nextdir(); |
@@ -259,6 +259,23 @@ function nextdir(dirname) {
|
259 | 259 | cpSync(src, dest, mustNotMutateObjectDeep({ recursive: true })); |
260 | 260 | } |
261 | 261 | |
| 262 | +// It allows cp copying symlinks in src to locations in dest with existing synlinks not pointing to a directory. |
| 263 | +{ |
| 264 | +const src = nextdir(); |
| 265 | +const dest = nextdir(); |
| 266 | +mkdirSync(src, mustNotMutateObjectDeep({ recursive: true })); |
| 267 | +writeFileSync(`${src}/test.txt`, 'test'); |
| 268 | +symlinkSync(resolve(`${src}/test.txt`), join(src, 'link.txt')); |
| 269 | +cp(src, dest, { recursive: true }, |
| 270 | +mustCall((err) => { |
| 271 | +assert.strictEqual(err, null); |
| 272 | + |
| 273 | +cp(src, dest, { recursive: true }, mustCall((err) => { |
| 274 | +assert.strictEqual(err, null); |
| 275 | +})); |
| 276 | +})); |
| 277 | +} |
| 278 | + |
262 | 279 | // It throws error if symlink in dest points to location in src. |
263 | 280 | { |
264 | 281 | const src = nextdir(); |
|