diff --git a/.github/workflows/integrate.yml b/.github/workflows/integrate.yml index ba6eaf2..c0138ed 100644 --- a/.github/workflows/integrate.yml +++ b/.github/workflows/integrate.yml @@ -30,3 +30,6 @@ jobs: - name: Lint run: deno lint + + - name: Test + run: deno test -A diff --git a/src/build.test.ts b/src/build.test.ts index 8e634c4..6f00cd9 100644 --- a/src/build.test.ts +++ b/src/build.test.ts @@ -1,7 +1,4 @@ -import { - assert, - assertEquals, -} from "https://deno.land/std@0.177.0/testing/asserts.ts"; +import { assert } from "https://deno.land/std@0.177.0/testing/asserts.ts"; Deno.test({ name: "Able to build the current project", @@ -30,13 +27,21 @@ Deno.test({ }); await new Promise((resolve) => { - setTimeout(() => { - resolve(); - }, 600); + const check_if_port_is_open = async () => { + try { + const { status } = await fetch("http://localhost:4507/mononykus/", { + method: "HEAD", + }); + if (status === 200) resolve(); + } catch (_) { + setTimeout(check_if_port_is_open, 60); + } + }; + return check_if_port_is_open(); }); const response = await fetch("http://localhost:4507/mononykus/"); - assertEquals(response.status, 200); + const html = await response.text(); process.kill();