test: cleaned up test runner
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user