-
Notifications
You must be signed in to change notification settings - Fork 270
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix various timing and impl bugs with tests
- Loading branch information
1 parent
80aa8ec
commit cb0bd7e
Showing
7 changed files
with
52 additions
and
28 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,27 +1,29 @@ | ||
const fs = require("fs"); | ||
const { resolve } = require("path"); | ||
|
||
let cleanupFile = null; | ||
exports.getFileHelper = () => { | ||
let cleanupFile = null; | ||
|
||
afterEach(() => { | ||
if (!cleanupFile) return; | ||
try { | ||
fs.unlinkSync(cleanupFile); | ||
} catch (e) {} | ||
cleanupFile = null; | ||
}); | ||
afterEach(() => { | ||
if (!cleanupFile) return; | ||
try { | ||
fs.unlinkSync(cleanupFile); | ||
} catch (e) {} | ||
cleanupFile = null; | ||
}); | ||
|
||
const getFilePath = async (path) => { | ||
const expectedFilePath = resolve(__dirname, path); | ||
const getFilePath = async (path) => { | ||
const expectedFilePath = resolve(__dirname, path); | ||
|
||
cleanupFile = expectedFilePath; | ||
try { | ||
await fs.promises.unlink(cleanupFile); | ||
} catch (e) {} | ||
cleanupFile = expectedFilePath; | ||
try { | ||
await fs.promises.unlink(cleanupFile); | ||
} catch (e) {} | ||
|
||
return expectedFilePath; | ||
}; | ||
return expectedFilePath; | ||
}; | ||
|
||
module.exports = { | ||
getFilePath, | ||
return { | ||
getFilePath, | ||
}; | ||
}; |
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