summaryrefslogtreecommitdiff
path: root/packages/integrations/deno/test/helpers.js
blob: 659d24d5ecb879610305b70304b8e5f85011749b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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();
}