summaryrefslogtreecommitdiff
path: root/packages/integrations/deno/test/helpers.ts
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2023-06-05 15:05:16 +0800
committerGravatar GitHub <noreply@github.com> 2023-06-05 15:05:16 +0800
commitef410fa30bb24962df61e825c970d411298f3750 (patch)
treeec2305f133df99d97bcfccb875d115d3f65adbd1 /packages/integrations/deno/test/helpers.ts
parentc8959813864c0ce8d408cc2244bcae1516f2b9f4 (diff)
downloadastro-ef410fa30bb24962df61e825c970d411298f3750.tar.gz
astro-ef410fa30bb24962df61e825c970d411298f3750.tar.zst
astro-ef410fa30bb24962df61e825c970d411298f3750.zip
Simplify Deno test (#7276)
Diffstat (limited to '')
-rw-r--r--packages/integrations/deno/test/helpers.ts20
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 };
}