0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2024-12-23 21:53:55 -05:00
astro/packages/integrations/deno/test/helpers.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
647 B
JavaScript
Raw Normal View History

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'],
2022-03-30 07:43:13 -05:00
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/server/entry.mjs', url));
2022-04-15 16:02:19 -05:00
if (!mod.running()) {
mod.start();
}
await cb();
await mod.stop();
await close();
}