diff --git a/lib/copy-sync/__tests__/copy-sync-case-insensitive-paths.test.js b/lib/copy-sync/__tests__/copy-sync-case-insensitive-paths.test.js index 5bc70e4a..216c58b2 100644 --- a/lib/copy-sync/__tests__/copy-sync-case-insensitive-paths.test.js +++ b/lib/copy-sync/__tests__/copy-sync-case-insensitive-paths.test.js @@ -19,11 +19,12 @@ describe('+ copySync() - case insensitive paths', () => { afterEach(done => fs.remove(TEST_DIR, done)) - describe('> when the source is a directory', () => { + describe('> when src is a directory', () => { it('should behave correctly based on the OS', () => { src = path.join(TEST_DIR, 'srcdir') fs.outputFileSync(path.join(src, 'subdir', 'file.txt'), 'some data') dest = path.join(TEST_DIR, 'srcDir') + let errThrown = false try { fs.copySync(src, dest) @@ -32,20 +33,24 @@ describe('+ copySync() - case insensitive paths', () => { assert.strictEqual(err.message, 'Source and destination must not be the same.') assert(fs.existsSync(src)) assert(!fs.existsSync(dest)) + errThrown = true } } + if (os === 'darwin' || os === 'win32') assert(errThrown) if (os === 'linux') { assert(fs.existsSync(dest)) assert.strictEqual(fs.readFileSync(path.join(dest, 'subdir', 'file.txt'), 'utf8'), 'some data') + assert(!errThrown) } }) }) - describe('> when the source is a file', () => { + describe('> when src is a file', () => { it('should behave correctly based on the OS', () => { src = path.join(TEST_DIR, 'srcfile') fs.outputFileSync(src, 'some data') dest = path.join(TEST_DIR, 'srcFile') + let errThrown = false try { fs.copySync(src, dest) @@ -54,22 +59,26 @@ describe('+ copySync() - case insensitive paths', () => { assert.strictEqual(err.message, 'Source and destination must not be the same.') assert(fs.existsSync(src)) assert(!fs.existsSync(dest)) + errThrown = true } } + if (os === 'darwin' || os === 'win32') assert(errThrown) if (os === 'linux') { assert(fs.existsSync(dest)) assert.strictEqual(fs.readFileSync(dest, 'utf8'), 'some data') + assert(!errThrown) } }) }) - describe('> when the source is a symlink', () => { + describe('> when src is a symlink', () => { it('should behave correctly based on the OS, symlink dir', () => { src = path.join(TEST_DIR, 'srcdir') fs.outputFileSync(path.join(src, 'subdir', 'file.txt'), 'some data') const srcLink = path.join(TEST_DIR, 'src-symlink') fs.symlinkSync(src, srcLink, 'dir') dest = path.join(TEST_DIR, 'srcDir') + let errThrown = false try { fs.copySync(src, dest) @@ -78,13 +87,16 @@ describe('+ copySync() - case insensitive paths', () => { assert.strictEqual(err.message, 'Source and destination must not be the same.') assert(fs.existsSync(src)) assert(!fs.existsSync(dest)) + errThrown = true } } + if (os === 'darwin' || os === 'win32') assert(errThrown) if (os === 'linux') { assert(fs.existsSync(dest)) assert.strictEqual(fs.readFileSync(path.join(dest, 'subdir', 'file.txt'), 'utf8'), 'some data') const link = fs.readlinkSync(srcLink) assert.strictEqual(link, dest) + assert(!errThrown) } }) @@ -94,6 +106,7 @@ describe('+ copySync() - case insensitive paths', () => { const srcLink = path.join(TEST_DIR, 'src-symlink') fs.symlinkSync(src, srcLink, 'file') dest = path.join(TEST_DIR, 'srcFile') + let errThrown = false try { fs.copySync(src, dest) @@ -102,13 +115,16 @@ describe('+ copySync() - case insensitive paths', () => { assert.strictEqual(err.message, 'Source and destination must not be the same.') assert(fs.existsSync(src)) assert(!fs.existsSync(dest)) + errThrown = true } } + if (os === 'darwin' || os === 'win32') assert(errThrown) if (os === 'linux') { assert(fs.existsSync(dest)) assert.strictEqual(fs.readFileSync(dest, 'utf8'), 'some data') const link = fs.readlinkSync(srcLink) assert.strictEqual(link, dest) + assert(!errThrown) } }) }) diff --git a/lib/copy-sync/__tests__/copy-sync-dir.test.js b/lib/copy-sync/__tests__/copy-sync-dir.test.js index e31360b2..9c326736 100644 --- a/lib/copy-sync/__tests__/copy-sync-dir.test.js +++ b/lib/copy-sync/__tests__/copy-sync-dir.test.js @@ -20,7 +20,7 @@ describe('+ copySync()', () => { fs.emptyDir(TEST_DIR, done) }) - describe('> when the source is a directory', () => { + describe('> when src is a directory', () => { describe('> when dest exists and is a file', () => { it('should throw error', () => { const src = path.join(TEST_DIR, 'src') diff --git a/lib/copy-sync/__tests__/copy-sync-file.test.js b/lib/copy-sync/__tests__/copy-sync-file.test.js index 2874c120..fd58c1c7 100644 --- a/lib/copy-sync/__tests__/copy-sync-file.test.js +++ b/lib/copy-sync/__tests__/copy-sync-file.test.js @@ -20,7 +20,7 @@ describe('+ copySync()', () => { afterEach(done => fs.remove(TEST_DIR, done)) - describe('> when the source is a file', () => { + describe('> when src is a file', () => { it('should copy the file synchronously', () => { const fileSrc = path.join(TEST_DIR, 'TEST_fs-extra_src') const fileDest = path.join(TEST_DIR, 'TEST_fs-extra_copy') @@ -104,7 +104,7 @@ describe('+ copySync()', () => { }) }) - describe('> when the source file does not have write permissions', () => { + describe('> when src file does not have write permissions', () => { it('should be able to copy contents of file', () => { const fileSrc = path.join(TEST_DIR, 'file.txt') const fileDest = path.join(TEST_DIR, 'file-copy.txt') diff --git a/lib/copy-sync/__tests__/copy-sync-prevent-copying-identical.test.js b/lib/copy-sync/__tests__/copy-sync-prevent-copying-identical.test.js index 6dabcc47..398e6687 100644 --- a/lib/copy-sync/__tests__/copy-sync-prevent-copying-identical.test.js +++ b/lib/copy-sync/__tests__/copy-sync-prevent-copying-identical.test.js @@ -35,7 +35,7 @@ describe('+ copySync() - prevent copying identical files and dirs', () => { // src is symlink, dest is regular // src is symlink, dest is symlink - describe('> when the source is a directory', () => { + describe('> when src is a directory', () => { describe(`>> when src is regular and dest is a symlink that points to src`, () => { it('should error', () => { src = path.join(TEST_DIR, 'src') @@ -121,7 +121,7 @@ describe('+ copySync() - prevent copying identical files and dirs', () => { // src is symlink, dest is regular // src is symlink, dest is symlink - describe('> when the source is a file', () => { + describe('> when src is a file', () => { describe(`>> when src is regular and dest is a symlink that points to src`, () => { it('should error', () => { src = path.join(TEST_DIR, 'src', 'somefile.txt') diff --git a/lib/copy/__tests__/copy-case-insensitive-paths.test.js b/lib/copy/__tests__/copy-case-insensitive-paths.test.js index 46d93cf7..9c581324 100644 --- a/lib/copy/__tests__/copy-case-insensitive-paths.test.js +++ b/lib/copy/__tests__/copy-case-insensitive-paths.test.js @@ -19,7 +19,7 @@ describe('+ copy() - case insensitive paths', () => { afterEach(done => fs.remove(TEST_DIR, done)) - describe('> when the source is a directory', () => { + describe('> when src is a directory', () => { it('should behave correctly based on the OS', done => { src = path.join(TEST_DIR, 'srcdir') fs.outputFileSync(path.join(src, 'subdir', 'file.txt'), 'some data') @@ -41,7 +41,7 @@ describe('+ copy() - case insensitive paths', () => { }) }) - describe('> when the source is a file', () => { + describe('> when src is a file', () => { it('should behave correctly based on the OS', done => { src = path.join(TEST_DIR, 'srcfile') fs.outputFileSync(src, 'some data') @@ -63,7 +63,7 @@ describe('+ copy() - case insensitive paths', () => { }) }) - describe('> when the source is a symlink', () => { + describe('> when src is a symlink', () => { it('should behave correctly based on the OS, symlink dir', done => { src = path.join(TEST_DIR, 'srcdir') fs.outputFileSync(path.join(src, 'subdir', 'file.txt'), 'some data') diff --git a/lib/copy/__tests__/copy-prevent-copying-identical.test.js b/lib/copy/__tests__/copy-prevent-copying-identical.test.js index 4c13d0b6..acb260c5 100644 --- a/lib/copy/__tests__/copy-prevent-copying-identical.test.js +++ b/lib/copy/__tests__/copy-prevent-copying-identical.test.js @@ -35,7 +35,7 @@ describe('+ copy() - prevent copying identical files and dirs', () => { // src is symlink, dest is regular // src is symlink, dest is symlink - describe('> when the source is a directory', () => { + describe('> when src is a directory', () => { describe(`>> when src is regular and dest is a symlink that points to src`, () => { it('should error', done => { src = path.join(TEST_DIR, 'src') @@ -122,7 +122,7 @@ describe('+ copy() - prevent copying identical files and dirs', () => { // src is symlink, dest is regular // src is symlink, dest is symlink - describe('> when the source is a file', () => { + describe('> when src is a file', () => { describe(`>> when src is regular and dest is a symlink that points to src`, () => { it('should error', done => { src = path.join(TEST_DIR, 'src', 'somefile.txt') diff --git a/lib/copy/__tests__/copy.test.js b/lib/copy/__tests__/copy.test.js index 98692b40..90473a5e 100644 --- a/lib/copy/__tests__/copy.test.js +++ b/lib/copy/__tests__/copy.test.js @@ -54,7 +54,7 @@ describe('fs-extra', () => { }) }) - describe('> when the source is a file', () => { + describe('> when src is a file', () => { it('should copy the file asynchronously', done => { const fileSrc = path.join(TEST_DIR, 'TEST_fs-extra_src') const fileDest = path.join(TEST_DIR, 'TEST_fs-extra_copy') @@ -70,7 +70,7 @@ describe('fs-extra', () => { }) }) - it('should return an error if the source file does not exist', done => { + it('should return an error if src file does not exist', done => { const fileSrc = 'we-simply-assume-this-file-does-not-exist.bin' const fileDest = path.join(TEST_DIR, 'TEST_fs-extra_copy') @@ -110,8 +110,8 @@ describe('fs-extra', () => { }) }) - describe('> when the source is a directory', () => { - describe('> when the source directory does not exist', () => { + describe('> when src is a directory', () => { + describe('> when src directory does not exist', () => { it('should return an error', done => { const ts = path.join(TEST_DIR, 'this_dir_does_not_exist') const td = path.join(TEST_DIR, 'this_dir_really_does_not_matter')