(dirName: string)
| 8 | } |
| 9 | |
| 10 | export async function teardownTestFolder(dirName: string) { |
| 11 | try { |
| 12 | const stats = await stat(dirName); |
| 13 | if (!stats.isDirectory()) { |
| 14 | console.warn( |
| 15 | `⚠️ You are trying to delete a file instead of a directory - ${ansis.bold( |
| 16 | dirName, |
| 17 | )}.`, |
| 18 | ); |
| 19 | } |
| 20 | } catch { |
| 21 | // continue safely without deleting as folder does not exist in the filesystem |
| 22 | return; |
| 23 | } |
| 24 | |
| 25 | try { |
| 26 | await rm(dirName, { |
| 27 | recursive: true, |
| 28 | force: true, |
| 29 | maxRetries: 2, |
| 30 | retryDelay: 100, |
| 31 | }); |
| 32 | } catch { |
| 33 | console.warn( |
| 34 | `⚠️ Failed to delete test artefact ${ansis.bold( |
| 35 | dirName, |
| 36 | )} so the folder is still in the file system!\nIt may require a deletion before running e2e tests again.`, |
| 37 | ); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * File names that need to be restored by removing the "_" prefix. |
no test coverage detected