From 09ffff7c561c2b354d48835b334ab292dfde013a Mon Sep 17 00:00:00 2001 From: Rushil Perera Date: Wed, 12 Jun 2024 09:33:14 -0400 Subject: [PATCH] test: create test runner to do initial setup for DB --- .github/workflows/main.yml | 2 +- testRunner.ts | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 testRunner.ts diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b871b2e..db1b500 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -14,7 +14,7 @@ jobs: - name: Install run: bun install - name: Test - run: bun test + run: bun run test # TODO: uncomment this when https://github.com/cloudflare/workers-sdk/issues/5082 is fixed # - name: Verify env # run: bun env:verify diff --git a/testRunner.ts b/testRunner.ts new file mode 100644 index 0000000..484ae6c --- /dev/null +++ b/testRunner.ts @@ -0,0 +1,13 @@ +import { $ } from "zx"; + +const tursoProcess = $`turso dev --port 3000`.nothrow(); + +process.env.TURSO_URL = "http://127.0.0.1:3000"; +process.env.TURSO_AUTH_TOKEN = "asd"; +await $`bun db:migrate`.nothrow(); +await $({ + verbose: true, + quote: (arg) => arg, +})`FORCE_COLOR=1 bun test ${process.argv.slice(2).join(" ")}`.nothrow(); + +await tursoProcess.kill("SIGINT");