diff options
author | 2023-06-05 15:05:16 +0800 | |
---|---|---|
committer | 2023-06-05 15:05:16 +0800 | |
commit | ef410fa30bb24962df61e825c970d411298f3750 (patch) | |
tree | ec2305f133df99d97bcfccb875d115d3f65adbd1 /packages/integrations/deno/test/helpers.ts | |
parent | c8959813864c0ce8d408cc2244bcae1516f2b9f4 (diff) | |
download | astro-ef410fa30bb24962df61e825c970d411298f3750.tar.gz astro-ef410fa30bb24962df61e825c970d411298f3750.tar.zst astro-ef410fa30bb24962df61e825c970d411298f3750.zip |
Simplify Deno test (#7276)
Diffstat (limited to 'packages/integrations/deno/test/helpers.ts')
-rw-r--r-- | packages/integrations/deno/test/helpers.ts | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/packages/integrations/deno/test/helpers.ts b/packages/integrations/deno/test/helpers.ts index e69abbebb..ac451d963 100644 --- a/packages/integrations/deno/test/helpers.ts +++ b/packages/integrations/deno/test/helpers.ts @@ -12,7 +12,6 @@ export const defaultTestPermissions: Deno.PermissionOptions = { env: true, }; -export declare type StartServerCallback = (url: URL) => Promise<void>; declare type ExitCallback = () => void; export async function runBuild(fixturePath: string) { @@ -59,31 +58,20 @@ export async function startModFromSubprocess(baseUrl: URL): Promise<ExitCallback return () => proc.close(); } -export async function runBuildAndStartApp(fixturePath: string, cb: StartServerCallback) { +export async function runBuildAndStartApp(fixturePath: string) { const url = new URL(fixturePath, dir); await runBuild(fixturePath); const stop = await startModFromImport(url); - try { - await cb(defaultURL); - } finally { - stop(); - } + return { url: defaultURL, stop }; } -export async function runBuildAndStartAppFromSubprocess( - fixturePath: string, - cb: StartServerCallback -) { +export async function runBuildAndStartAppFromSubprocess(fixturePath: string) { const url = new URL(fixturePath, dir); await runBuild(fixturePath); const stop = await startModFromSubprocess(url); - try { - await cb(defaultURL); - } finally { - stop(); - } + return { url: defaultURL, stop }; } |