2022-03-30 07:42:19 -05:00
|
|
|
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)),
|
2022-03-30 07:42:19 -05:00
|
|
|
});
|
|
|
|
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);
|
2022-03-31 12:58:03 -05:00
|
|
|
const mod = await import(new URL('./dist/server/entry.mjs', url));
|
2022-03-30 07:42:19 -05:00
|
|
|
await cb();
|
|
|
|
await mod.stop();
|
|
|
|
await close();
|
|
|
|
}
|