* Resets the TestSandbox. (Remove all files in it).
()
| 94 | * Resets the TestSandbox. (Remove all files in it). |
| 95 | */ |
| 96 | async reset(): Promise<void> { |
| 97 | // Decache files from require's cache so future tests aren't affected incase |
| 98 | // a file is recreated in sandbox with the same file name but different |
| 99 | // contents after resetting the sandbox. |
| 100 | for (const key in require.cache) { |
| 101 | if (key.startsWith(this.path)) { |
| 102 | delete require.cache[key]; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | await emptyDir(this.path); |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * Deletes the TestSandbox. |
no outgoing calls
no test coverage detected