-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: 🐛 resolve bad recursive delete dirs and usage of rimraf
- Loading branch information
1 parent
95f6106
commit 12fad4e
Showing
7 changed files
with
74 additions
and
31 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
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 |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { buildPath, deleteDirectory } from './test_utils.js'; | ||
|
||
const useRetriever = () => { | ||
let selectedPathToClear = ''; | ||
|
||
const pathToClear = (path = ''): string => { | ||
if (path === '') { | ||
return selectedPathToClear; | ||
} | ||
|
||
if (path.indexOf(buildPath(''))) { | ||
throw new Error('Unable to set a path to clear that is not in the build path'); | ||
} | ||
|
||
const previousPath = selectedPathToClear; | ||
selectedPathToClear = path; | ||
|
||
return previousPath; | ||
}; | ||
|
||
// eslint-disable-next-line vitest/require-top-level-describe | ||
afterEach(async () => { | ||
if (pathToClear() !== '') { | ||
await deleteDirectory(pathToClear()); | ||
} | ||
}); | ||
|
||
return { | ||
pathToClear, | ||
}; | ||
}; | ||
|
||
export default useRetriever; |
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