({ n, dereference, force })
| 26 | } |
| 27 | |
| 28 | function main({ n, dereference, force }) { |
| 29 | tmpdir.refresh(); |
| 30 | |
| 31 | const src = prepareTestDirectory(); |
| 32 | const dest = tmpdir.resolve(`${process.pid}/subdir/cp-bench-${process.pid}`); |
| 33 | |
| 34 | const options = { |
| 35 | recursive: true, |
| 36 | dereference: dereference === 'true', |
| 37 | force: force === 'true', |
| 38 | }; |
| 39 | |
| 40 | if (options.force) { |
| 41 | fs.cpSync(src, dest, { recursive: true }); |
| 42 | } |
| 43 | |
| 44 | bench.start(); |
| 45 | for (let i = 0; i < n; i++) { |
| 46 | if (options.force) { |
| 47 | fs.cpSync(src, dest, options); |
| 48 | } else { |
| 49 | const uniqueDest = tmpdir.resolve( |
| 50 | `${process.pid}/subdir/cp-bench-${process.pid}-${i}`, |
| 51 | ); |
| 52 | fs.cpSync(src, uniqueDest, options); |
| 53 | } |
| 54 | } |
| 55 | bench.end(n); |
| 56 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…