Files
zkldi_Tachi/Justfile-test
T
2026-03-28 13:15:03 +00:00

94 lines
2.2 KiB
Plaintext

check:
#!/bin/bash
set -euo pipefail
source .scripts/multi_evaluator.sh
evaluate "just fmt-check"
evaluate "bun run --filter '*' lint"
evaluate "just typecheck"
post_evaluate
typecheck:
bun run --filter '!tachi-seeds-scripts' typecheck
fix:
#!/bin/bash
set -euo pipefail
just gen
bun run --filter '*' lint-fix
.scripts/ts_autoinherit.js
just fmt
# Automatically fix any issues we can in the codebase and then
# make a commit for them
autofix:
#!/bin/bash
set -euo pipefail
# Only generate a commit if the repo is clean
SHOULD_COMMIT=0
if [ -z "$(git status --porcelain)" ]; then
SHOULD_COMMIT=1
fi
just fix
if [ $SHOULD_COMMIT -eq 1 ]; then
git add .
git commit -m "chore: autofix"
fi
fmt:
bun biome format --write
bun prettier --write --list-different .
# cd deploy/infra && tofu fmt -diff
fmt-check:
bun biome format
bun prettier --check .
# cd deploy/infra && tofu fmt --check -diff
test FILTER="*":
#!/bin/bash
set -euo pipefail
source .scripts/multi_evaluator.sh
evaluate "just test-typescript '{{FILTER}}'"
post_evaluate
test-typescript FILTER="*":
#!/bin/bash
set -euo pipefail
bun run --filter '{{FILTER}}' test -- --coverage.reporter=lcov --reporter=default --reporter=junit --outputFile.junit=test-results/junit.xml
# Run all parity suites, or a single one if a name is given.
test-parity suite="":
TACHI_SERVER=https://127.0.0.1:8080 bun vitest run {{ if suite != "" { "tests/" + suite + ".test.ts" } else { "" } }}
# ==> Orchestration of parallel db tests
# Create (or recreate) the bot test template database with all migrations applied.
# Workers clone from this template rather than re-running migrations each time.
bot-db-test-template-reset:
#!/bin/bash
export POSTGRES_URL="{{POSTGRES_URL}}/tachi_bot_test_template"
tachidb database drop || true
tachidb database create
tachidb migrate run
# Create (or recreate) the server test template database with all migrations applied.
# Workers clone from this template rather than re-running migrations each time.
server-db-test-template-reset:
#!/bin/bash
export POSTGRES_URL="{{POSTGRES_URL}}/tachi_server_test_template"
tachidb database drop || true
tachidb database create
tachidb migrate run
# <== End of parallel db test justscripts