Files
Bryce Berger 92a51cfbfe rust: hooks: avoid fancy progress reporting by nextest
In [0.9.109], nextest added a `--show-progress=running` mode that
shows an interactive view of currently running tests. This is nice in
interactive use. However, it's very annoying when viewing logs after the
fact, such as through `nix log ...`.

`--show-progress=none` reverts to the simple interface, reporting a
single line for each test run with no control codes.

[0.9.109]: https://github.com/nextest-rs/nextest/releases/tag/cargo-nextest-0.9.109
2026-02-24 07:13:35 -05:00

54 lines
1.2 KiB
Bash

# shellcheck shell=bash disable=SC2154,SC2164
cargoNextestHook() {
echo "Executing cargoNextestHook"
runHook preCheck
if [[ -n "${buildAndTestSubdir-}" ]]; then
pushd "${buildAndTestSubdir}"
fi
local flagsArray=(
"--target" "@rustcTargetSpec@"
"--offline"
"--show-progress=none"
)
if [[ -z ${dontUseCargoParallelTests-} ]]; then
flagsArray+=("-j" "$NIX_BUILD_CORES")
else
flagsArray+=("-j" "1")
fi
if [ "${cargoCheckType}" != "debug" ]; then
flagsArray+=("--cargo-profile" "${cargoCheckType}")
fi
if [ -n "${cargoCheckNoDefaultFeatures-}" ]; then
flagsArray+=("--no-default-features")
fi
if [ -n "${cargoCheckFeatures-}" ]; then
flagsArray+=("--features=$(concatStringsSep "," cargoCheckFeatures)")
fi
prependToVar checkFlags "--"
concatTo flagsArray cargoTestFlags checkFlags checkFlagsArray
echoCmd 'cargoNextestHook flags' "${flagsArray[@]}"
cargo nextest run "${flagsArray[@]}"
if [[ -n "${buildAndTestSubdir-}" ]]; then
popd
fi
echo "Finished cargoNextestHook"
runHook postCheck
}
if [ -z "${dontCargoCheck-}" ] && [ -z "${checkPhase-}" ]; then
checkPhase=cargoNextestHook
fi