2022-03-30 12:42:19 +00: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 12:43:13 +00:00
|
|
|
cwd: fromFileUrl(new URL(fixturePath, dir)),
|
2022-03-30 12:42:19 +00: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 17:58:03 +00:00
|
|
|
const mod = await import(new URL('./dist/server/entry.mjs', url));
|
2022-03-30 12:42:19 +00:00
|
|
|
await cb();
|
|
|
|
await mod.stop();
|
|
|
|
await close();
|
|
|
|
}
|