Allow arbitrary arguments to the justfile test commands. (#650)

Sometimes you just want to run a specific test.

The arguments are passed straight to the test runner: `cargo nextest` if
you have it installed, and `cargo test` if you do not. These accept
different arguments so the user will need to know which one they are
using.

V3_GIT_ORIGIN_REV_ID: 9cd6f9d770899e0bb3aa4537008eedba052818d7
This commit is contained in:
Samir Talwar 2024-05-31 17:10:36 +03:00 committed by hasura-bot
parent dfccac348e
commit c80ab33726

View File

@ -58,14 +58,10 @@ fix-format:
ci-test: docker-refresh ci-test: docker-refresh
just docker_with_test_env cargo nextest run --archive-file=./bin/nextest.tar.zst --no-fail-fast just docker_with_test_env cargo nextest run --archive-file=./bin/nextest.tar.zst --no-fail-fast
test TESTNAME='': test *ARGS:
#!/usr/bin/env bash #!/usr/bin/env bash
if [[ -z '{{TESTNAME}}' ]]; then COMMAND=(cargo nextest run --archive-file=./bin/nextest.tar.zst --no-fail-fast "$@")
COMMAND=(cargo nextest run --archive-file=./bin/nextest.tar.zst --no-fail-fast) echo "cargo nextest run --no-fail-fast $*"
else
COMMAND=(cargo nextest run --archive-file=./bin/nextest.tar.zst --no-fail-fast -E 'test(={{TESTNAME}})')
fi
echo "${COMMAND[*]}"
just docker_with_test_env "${COMMAND[@]}" just docker_with_test_env "${COMMAND[@]}"
update-golden-files: docker-refresh update-golden-files: docker-refresh
@ -124,8 +120,16 @@ stop-docker:
# 127.0.0.1 custom_connector # 127.0.0.1 custom_connector
# run the tests using local engine (once) # run the tests using local engine (once)
test-local: start-docker-test-deps test-local *ARGS: start-docker-test-deps
cargo test #!/usr/bin/env bash
if command -v cargo-nextest; then
COMMAND=(cargo nextest run)
else
COMMAND=(cargo test)
fi
COMMAND+=(--no-fail-fast "$@")
echo "${COMMAND[*]}"
"${COMMAND[@]}"
# run a watch process that runs the tests locally # run a watch process that runs the tests locally
watch-local: start-docker-test-deps start-docker-run-deps watch-local: start-docker-test-deps start-docker-run-deps