diff options
Diffstat (limited to 'packages/integrations/deno/test/helpers.js')
-rw-r--r-- | packages/integrations/deno/test/helpers.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/packages/integrations/deno/test/helpers.js b/packages/integrations/deno/test/helpers.js new file mode 100644 index 000000000..df4f7c934 --- /dev/null +++ b/packages/integrations/deno/test/helpers.js @@ -0,0 +1,20 @@ +import { fromFileUrl } from './deps.js'; +const dir = new URL('./', import.meta.url); + +export async function runBuild(fixturePath) { + let proc = Deno.run({ + cmd: ['node', '../../../../../astro/astro.js', 'build', '--silent'], + cwd: fromFileUrl(new URL(fixturePath, dir)) + }); + await proc.status(); + return async () => await proc.close(); +} + +export async function runBuildAndStartApp(fixturePath, cb) { + const url = new URL(fixturePath, dir); + const close = await runBuild(fixturePath); + const mod = await import(new URL('./dist/entry.mjs', url)); + await cb(); + await mod.stop(); + await close(); +} |