MCPcopy Index your code
hub / github.com/code-pushup/cli / teardownTestFolder

Function teardownTestFolder

testing/test-utils/src/lib/utils/test-folder-setup.ts:10–39  ·  view source on GitHub ↗
(dirName: string)

Source from the content-addressed store, hash-verified

8}
9
10export 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.

Callers 15

git.int.test.tsFile · 0.90
run.int.test.tsFile · 0.90
runner.int.test.tsFile · 0.90
rules.int.test.tsFile · 0.90
nx.int.test.tsFile · 0.90

Calls 1

warnMethod · 0.80

Tested by

no test coverage detected