MCPcopy Create free account
hub / github.com/vercel/vercel / getWorkDir

Function getWorkDir

packages/backends/test/unit.test.ts:107–124  ·  view source on GitHub ↗
(fixtureName: string, fixtureSource: string)

Source from the content-addressed store, hash-verified

105);
106
107const getWorkDir = async (fixtureName: string, fixtureSource: string) => {
108 // Always copy source to a random tmp dir
109 const tempDir = await realpath(
110 await mkdtemp(join(tmpdir(), `fixture-${fixtureName}-`))
111 );
112 await cp(fixtureSource, tempDir, { recursive: true });
113
114 // When USE_DEBUG_DIR is true, lambda output goes to debug/{fixtureName}
115 // Otherwise, lambda output goes to the same temp dir
116 let lambdaOutputDir = tempDir;
117 if (USE_DEBUG_DIR) {
118 lambdaOutputDir = join(DEBUG_DIR, fixtureName);
119 await rm(lambdaOutputDir, { recursive: true, force: true });
120 await mkdir(lambdaOutputDir, { recursive: true });
121 }
122
123 return { workDir: tempDir, lambdaOutputDir };
124};
125
126describe('successful builds', async () => {
127 const fixtures = await readdir(join(__dirname, 'fixtures'));

Callers 1

unit.test.tsFile · 0.85

Calls 1

rmFunction · 0.50

Tested by

no test coverage detected