Skip to content

Commit 4cd7931

Browse files
committed
tmp: make all integration test function invocations sandboxed
1 parent 9b149d4 commit 4cd7931

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

tests/utils/fixture.ts

+13-12
Original file line numberDiff line numberDiff line change
@@ -346,17 +346,18 @@ export async function invokeFunction(
346346
ctx: FixtureTestContext,
347347
options: FunctionInvocationOptions = {},
348348
) {
349-
// now for the execution set the process working directory to the dist entry point
350-
const cwdMock = vi
351-
.spyOn(process, 'cwd')
352-
.mockReturnValue(join(ctx.functionDist, SERVER_HANDLER_NAME))
353-
try {
354-
const { invokeFunction } = await loadFunction(ctx, options)
355-
356-
return invokeFunction(options)
357-
} finally {
358-
cwdMock.mockRestore()
359-
}
349+
return await invokeSandboxedFunction(ctx, options)
350+
// // now for the execution set the process working directory to the dist entry point
351+
// const cwdMock = vi
352+
// .spyOn(process, 'cwd')
353+
// .mockReturnValue(join(ctx.functionDist, SERVER_HANDLER_NAME))
354+
// try {
355+
// const { invokeFunction } = await loadFunction(ctx, options)
356+
357+
// return invokeFunction(options)
358+
// } finally {
359+
// cwdMock.mockRestore()
360+
// }
360361
}
361362

362363
export async function invokeEdgeFunction(
@@ -421,7 +422,7 @@ export async function loadSandboxedFunction(
421422
) {
422423
const childProcess = spawn(process.execPath, [import.meta.dirname + '/sandbox-child.mjs'], {
423424
stdio: ['pipe', 'pipe', 'pipe', 'ipc'],
424-
cwd: process.cwd(),
425+
cwd: join(ctx.functionDist, SERVER_HANDLER_NAME),
425426
env: {
426427
...process.env,
427428
...(options.env || {}),

0 commit comments

Comments
 (0)