@@ -85,6 +85,7 @@ function getValidatedPath(fileURLOrPath) {
85
85
86
86
async function cpFn ( src , dest , opts ) {
87
87
// Warn about using preserveTimestamps on 32-bit node
88
+ // istanbul ignore next
88
89
if ( opts . preserveTimestamps && process . arch === 'ia32' ) {
89
90
const warning = 'Using the preserveTimestamps option in 32-bit ' +
90
91
'node is not recommended' ;
@@ -170,6 +171,7 @@ async function checkParentDir(destStat, src, dest, opts) {
170
171
function pathExists ( dest ) {
171
172
return stat ( dest ) . then (
172
173
( ) => true ,
174
+ // istanbul ignore next: not sure when this would occur
173
175
( err ) => ( err . code === 'ENOENT' ? false : Promise . reject ( err ) ) ) ;
174
176
}
175
177
@@ -187,7 +189,9 @@ async function checkParentPaths(src, srcStat, dest) {
187
189
try {
188
190
destStat = await stat ( destParent , { bigint : true } ) ;
189
191
} catch ( err ) {
192
+ // istanbul ignore else: not sure when this would occur
190
193
if ( err . code === 'ENOENT' ) return ;
194
+ // istanbul ignore next: not sure when this would occur
191
195
throw err ;
192
196
}
193
197
if ( areIdentical ( srcStat , destStat ) ) {
@@ -227,6 +231,7 @@ function startCopy(destStat, src, dest, opts) {
227
231
async function getStatsForCopy ( destStat , src , dest , opts ) {
228
232
const statFn = opts . dereference ? stat : lstat ;
229
233
const srcStat = await statFn ( src ) ;
234
+ // istanbul ignore else: can't portably test FIFO
230
235
if ( srcStat . isDirectory ( ) && opts . recursive ) {
231
236
return onDir ( srcStat , destStat , src , dest , opts ) ;
232
237
} else if ( srcStat . isDirectory ( ) ) {
@@ -249,14 +254,15 @@ async function getStatsForCopy(destStat, src, dest, opts) {
249
254
syscall : 'cp' ,
250
255
errno : EINVAL ,
251
256
} ) ;
252
- } else if ( srcStat . isFIFO ( ) ) {
257
+ } else if ( srcStat . isFIFO ( ) ) {
253
258
throw new ERR_FS_CP_FIFO_PIPE ( {
254
259
message : `cannot copy a FIFO pipe: ${ dest } ` ,
255
260
path : dest ,
256
261
syscall : 'cp' ,
257
262
errno : EINVAL ,
258
263
} ) ;
259
264
}
265
+ // istanbul ignore next: should be unreachable
260
266
throw new ERR_FS_CP_UNKNOWN ( {
261
267
message : `cannot copy an unknown file type: ${ dest } ` ,
262
268
path : dest ,
@@ -365,9 +371,11 @@ async function onLink(destStat, src, dest) {
365
371
// Dest exists and is a regular file or directory,
366
372
// Windows may throw UNKNOWN error. If dest already exists,
367
373
// fs throws error anyway, so no need to guard against it here.
374
+ // istanbul ignore next: can only test on windows
368
375
if ( err . code === 'EINVAL' || err . code === 'UNKNOWN' ) {
369
376
return symlink ( resolvedSrc , dest ) ;
370
377
}
378
+ // istanbul ignore next: should not be possible
371
379
throw err ;
372
380
}
373
381
if ( ! isAbsolute ( resolvedDest ) ) {
0 commit comments