Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update dest
atime
after copy
/copy-sync
The `copyFileFallback` flow is now also tested on more recent Node, so it is now included in the code coverage metrics.
- Loading branch information
Showing
6 changed files
with
171 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const fs = require('graceful-fs') | ||
const path = require('path') | ||
|
||
/* global describe, beforeEach, afterEach */ | ||
|
||
if (typeof fs.copyFileSync === 'function') { | ||
// Also load copy tests without fs.copyFileSync | ||
describe('> when using copyFileFallback', () => { | ||
const originalCopyFileSync = fs.copyFileSync | ||
|
||
beforeEach(() => { | ||
// reset stubs | ||
delete fs.copyFileSync | ||
}) | ||
|
||
afterEach(() => { | ||
fs.copyFileSync = originalCopyFileSync | ||
}) | ||
|
||
const fallbackTest = path.basename(__filename) | ||
fs.readdirSync(__dirname) | ||
.filter(filename => filename.endsWith('.test.js') && filename !== fallbackTest) | ||
.map(filename => { | ||
const testModule = `./${filename}` | ||
delete require.cache[require.resolve(testModule)] | ||
require(testModule) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
const fs = require('graceful-fs') | ||
const path = require('path') | ||
|
||
/* global describe, beforeEach, afterEach */ | ||
|
||
if (typeof fs.copyFile === 'function') { | ||
// Also load copy tests without fs.copyFile | ||
describe('> when using copyFileFallback', () => { | ||
const originalCopyFile = fs.copyFile | ||
|
||
beforeEach(() => { | ||
// reset stubs | ||
delete fs.copyFile | ||
}) | ||
|
||
afterEach(() => { | ||
fs.copyFile = originalCopyFile | ||
}) | ||
|
||
const fallbackTest = path.basename(__filename) | ||
fs.readdirSync(__dirname) | ||
.filter(filename => filename.endsWith('.test.js') && filename !== fallbackTest) | ||
.map(filename => { | ||
const testModule = `./${filename}` | ||
delete require.cache[require.resolve(testModule)] | ||
require(testModule) | ||
}) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters