test: cleaned up test runner

This commit is contained in:
2024-06-13 06:14:44 -04:00
parent d038d30d9d
commit 9368ced0f7
3 changed files with 15 additions and 17 deletions

BIN
bun.lockb

Binary file not shown.

View File

@@ -32,7 +32,6 @@
"@cloudflare/workers-types": "^4.20240403.0",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/bun": "^1.1.2",
"@types/yargs": "^17.0.32",
"drizzle-kit": "^0.22.6",
"husky": "^9.0.11",
"lint-staged": "^15.2.7",
@@ -42,7 +41,6 @@
"ts-morph": "^22.0.0",
"typescript": "^5.4.5",
"wrangler": "^3.47.0",
"yargs": "^17.7.2",
"zx": "^8.1.2"
},
"lint-staged": {

View File

@@ -1,12 +1,10 @@
import yargs from "yargs";
import { $ } from "zx";
import { formatCmd } from "node_modules/zx/build/util";
import { $, minimist } from "zx";
const args = await yargs(process.argv).option("dbCommand", {
alias: "db",
type: "string",
description: "Command to spin up the database",
demandOption: true,
}).argv;
const args = minimist(process.argv.slice(2));
if (!args.dbCommand) {
throw new Error("dbCommand is required");
}
const filteredKeys = new Set(["_", "dbCommand", "db", "$0", "db-command"]);
const positionalArgs = Object.entries(args)
@@ -18,15 +16,17 @@ const positionalArgs = Object.entries(args)
return `--${key}=${value}`;
})
.concat(args._.slice(2).map((arg) => `${arg}`));
.concat(args._);
const dbProcess = $({
quote: (arg) => arg,
verbose: true,
})`${args.dbCommand}`.nothrow();
console.log(formatCmd(args.dbCommand));
const dbProcess = $({ quote: (arg) => arg })`${args.dbCommand}`.nothrow();
process.env.TURSO_URL = "http://127.0.0.1:3001";
process.env.TURSO_AUTH_TOKEN = "asd";
$.env = {
PATH: process.env.PATH,
HOME: process.env.HOME,
TURSO_URL: process.env.TURSO_URL ?? "http://127.0.0.1:3001",
TURSO_AUTH_TOKEN: process.env.TURSO_AUTH_TOKEN ?? "asd",
};
await $`bun db:migrate`.nothrow();
await $({
verbose: true,