From 5170b4f854d59c821a655b764c04abf62175f828 Mon Sep 17 00:00:00 2001 From: Ryan Zimmerman Date: Fri, 6 Apr 2018 12:55:53 -0400 Subject: [PATCH] copy*() preserveTimestamps: false behavior is OS-dependent Update docs and remove tests to reflect this --- docs/copy-sync.md | 2 +- docs/copy.md | 2 +- .../__tests__/copy-sync-preserve-time.test.js | 10 ---------- lib/copy/__tests__/copy-preserve-time.test.js | 11 ----------- 4 files changed, 2 insertions(+), 23 deletions(-) diff --git a/docs/copy-sync.md b/docs/copy-sync.md index ac64807f..76bfd477 100644 --- a/docs/copy-sync.md +++ b/docs/copy-sync.md @@ -8,7 +8,7 @@ Copy a file or directory. The directory can have contents. Like `cp -r`. - `overwrite` ``: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior. - `errorOnExist` ``: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`. - `dereference` ``: dereference symlinks, default is `false`. - - `preserveTimestamps` ``: will set last modification and access times to the ones of the original source files, default is `false`. + - `preserveTimestamps` ``: When true, will set last modification and access times to the ones of the original source files. When false, timestamp behavior is OS-dependent. Default is `false`. - `filter` ``: Function to filter copied files. Return `true` to include, `false` to exclude. ## Example: diff --git a/docs/copy.md b/docs/copy.md index d0f78a97..e5f8582b 100644 --- a/docs/copy.md +++ b/docs/copy.md @@ -8,7 +8,7 @@ Copy a file or directory. The directory can have contents. Like `cp -r`. - `overwrite` ``: overwrite existing file or directory, default is `true`. _Note that the copy operation will silently fail if you set this to `false` and the destination exists._ Use the `errorOnExist` option to change this behavior. - `errorOnExist` ``: when `overwrite` is `false` and the destination exists, throw an error. Default is `false`. - `dereference` ``: dereference symlinks, default is `false`. - - `preserveTimestamps` ``: will set last modification and access times to the ones of the original source files, default is `false`. + - `preserveTimestamps` ``: When true, will set last modification and access times to the ones of the original source files. When false, timestamp behavior is OS-dependent. Default is `false`. - `filter` ``: Function to filter copied files. Return `true` to include, `false` to exclude. Can also return a `Promise` that resolves to `true` or `false` (or pass in an `async` function). - `callback` `` diff --git a/lib/copy-sync/__tests__/copy-sync-preserve-time.test.js b/lib/copy-sync/__tests__/copy-sync-preserve-time.test.js index 820c2cf5..0b809767 100644 --- a/lib/copy-sync/__tests__/copy-sync-preserve-time.test.js +++ b/lib/copy-sync/__tests__/copy-sync-preserve-time.test.js @@ -29,16 +29,6 @@ describeIfPractical('copySync() - preserveTimestamps option', () => { afterEach(done => fs.remove(TEST_DIR, done)) - describe('> when preserveTimestamps option is false', () => { - it('should have different timestamps on copy', done => { - setTimeout(() => { - fs.copySync(SRC, DEST, {preserveTimestamps: false}) - FILES.forEach(testFile({preserveTimestamps: false})) - done() - }, 100) - }) - }) - describe('> when preserveTimestamps option is true', () => { it('should have the same timestamps on copy', () => { fs.copySync(SRC, DEST, {preserveTimestamps: true}) diff --git a/lib/copy/__tests__/copy-preserve-time.test.js b/lib/copy/__tests__/copy-preserve-time.test.js index 46b74f7c..326dc261 100644 --- a/lib/copy/__tests__/copy-preserve-time.test.js +++ b/lib/copy/__tests__/copy-preserve-time.test.js @@ -30,17 +30,6 @@ describeIfPractical('copy() - preserve timestamp', () => { afterEach(done => fs.remove(TEST_DIR, done)) - describe('> when timestamp option is false', () => { - it('should have different timestamps on copy', done => { - setTimeout(() => { - copy(SRC, DEST, {preserveTimestamps: false}, () => { - FILES.forEach(testFile({preserveTimestamps: false})) - done() - }) - }, 100) - }) - }) - describe('> when timestamp option is true', () => { it('should have the same timestamps on copy', done => { copy(SRC, DEST, {preserveTimestamps: true}, () => {