summaryrefslogtreecommitdiff
path: root/packages/integrations/deno/test/helpers.js
diff options
context:
space:
mode:
authorGravatar Matthew Phillips <matthew@skypack.dev> 2022-03-30 08:42:19 -0400
committerGravatar GitHub <noreply@github.com> 2022-03-30 08:42:19 -0400
commit13b271bc7d032f5f3749a9868532d12d442a09ef (patch)
tree4195d8472d0bb29b822054cf2b6184015f1e9eed /packages/integrations/deno/test/helpers.js
parent364ece8776e2544a141c390a73faed325e0deb5b (diff)
downloadastro-13b271bc7d032f5f3749a9868532d12d442a09ef.tar.gz
astro-13b271bc7d032f5f3749a9868532d12d442a09ef.tar.zst
astro-13b271bc7d032f5f3749a9868532d12d442a09ef.zip
Deno adapter (#2934)
* Bundle everything, commit 1 * Get everything working * Remove dependency on readable-stream * Adds a changeset * Fix ts errors * Use the node logger in tests * Callback the logger when done writing * Fix test helper to await the callback * Use serialize-javascript again * Remove dead code * Rename hook * Oops
Diffstat (limited to 'packages/integrations/deno/test/helpers.js')
-rw-r--r--packages/integrations/deno/test/helpers.js20
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();
+}