@@ -346,17 +346,18 @@ export async function invokeFunction(
346
346
ctx : FixtureTestContext ,
347
347
options : FunctionInvocationOptions = { } ,
348
348
) {
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
+ // }
360
361
}
361
362
362
363
export async function invokeEdgeFunction (
@@ -421,7 +422,7 @@ export async function loadSandboxedFunction(
421
422
) {
422
423
const childProcess = spawn ( process . execPath , [ import . meta. dirname + '/sandbox-child.mjs' ] , {
423
424
stdio : [ 'pipe' , 'pipe' , 'pipe' , 'ipc' ] ,
424
- cwd : process . cwd ( ) ,
425
+ cwd : join ( ctx . functionDist , SERVER_HANDLER_NAME ) ,
425
426
env : {
426
427
...process . env ,
427
428
...( options . env || { } ) ,
0 commit comments