-
Notifications
You must be signed in to change notification settings - Fork 773
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Maxime Bargiel
committed
Jul 31, 2019
1 parent
4828641
commit 2b7c0e5
Showing
4 changed files
with
36 additions
and
37 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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
const fs = require('fs') | ||
const fs = require('../../') | ||
const path = require('path') | ||
|
||
/* global after, describe */ | ||
/* global describe */ | ||
|
||
if (typeof fs.copyFileSync === 'function') { | ||
// Re-run all copySync tests without fs.copyFileSync | ||
// Also load copy-sync tests without fs.copyFileSync | ||
describe('> when using copyFileSyncFallback', () => { | ||
const originalCopyFile = fs.copyFileSync | ||
|
||
after(done => { | ||
fs.copyFileSync = originalCopyFile | ||
done() | ||
}) | ||
|
||
delete fs.copyFileSync | ||
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) | ||
}) | ||
try { | ||
fs.readdirSync(__dirname) | ||
.filter(filename => filename.endsWith('.test.js') && filename !== fallbackTest) | ||
.map(filename => { | ||
const testModule = `./${filename}` | ||
delete require.cache[require.resolve(testModule)] | ||
require(testModule) | ||
}) | ||
} finally { | ||
fs.copyFileSync = originalCopyFile | ||
} | ||
}) | ||
} |
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 |
---|---|---|
@@ -1,26 +1,25 @@ | ||
const fs = require('fs') | ||
const fs = require('../../') | ||
const path = require('path') | ||
|
||
/* global after, describe */ | ||
/* global describe */ | ||
|
||
if (typeof fs.copyFile === 'function') { | ||
// Re-run all copy tests without fs.copyFile | ||
// Also load copy tests without fs.copyFile | ||
describe('> when using copyFileFallback', () => { | ||
const originalCopyFile = fs.copyFile | ||
|
||
after(done => { | ||
fs.copyFile = originalCopyFile | ||
done() | ||
}) | ||
|
||
delete fs.copyFile | ||
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) | ||
}) | ||
try { | ||
fs.readdirSync(__dirname) | ||
.filter(filename => filename.endsWith('.test.js') && filename !== fallbackTest) | ||
.map(filename => { | ||
const testModule = `./${filename}` | ||
delete require.cache[require.resolve(testModule)] | ||
require(testModule) | ||
}) | ||
} finally { | ||
fs.copyFile = originalCopyFile | ||
} | ||
}) | ||
} |