Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion e2e/run_test
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ ROOT="$(cd "$SCRIPT_DIR"/.. && pwd)"
source "$SCRIPT_DIR/style.sh"

TEST="$1"
TEST_SCRIPT="$SCRIPT_DIR/$TEST"
# Handle both relative and absolute paths
if [[ $TEST == /* ]]; then
# If it's an absolute path, use it as is
TEST_SCRIPT="$TEST"
elif [[ $TEST == e2e/* ]]; then
# If it starts with e2e/, treat it as relative to the project root
TEST_SCRIPT="$ROOT/$TEST"
else
# Otherwise, treat it as relative to the e2e directory
TEST_SCRIPT="$SCRIPT_DIR/$TEST"
fi

setup_isolated_env() {
TEST_ISOLATED_DIR="$(mktemp --tmpdir --directory "$(basename "$TEST").XXXXXX")"
Expand Down
2 changes: 1 addition & 1 deletion tasks.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ run all tests with coverage report
- Depends: build

- **Usage**: `test:e2e`
- **Aliases**: `e`
- **Aliases**: `e`, `e2e`

run end-to-end tests

Expand Down
17 changes: 12 additions & 5 deletions xtasks/test/e2e
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#MISE depends=["build"]
#MISE alias="e"
#MISE alias=["e", "e2e"]
#MISE description="run end-to-end tests"
set -euo pipefail

Expand All @@ -9,14 +9,21 @@ export RUST_TEST_THREADS=1
if [[ ${1:-all} == all ]]; then
./e2e/run_all_tests
else
pushd e2e
FILES="$(fd -tf "$1" --and "^test_")"
popd
# Strip e2e/ prefix if present, then extract just the filename
PATTERN="${1#e2e/}"
FILENAME="$(basename "$PATTERN")"

pushd e2e >/dev/null
FILES="$(fd -tf "$FILENAME" --and "^test_")"
popd >/dev/null

if [[ -z $FILES ]]; then
echo "Not test matches $1" >&2
echo "No test matches $1" >&2
exit 1
fi

for FILE in $FILES; do
echo "[xtask:e2e] Running test: $FILE" >&2
./e2e/run_test "$FILE"
done
fi
Loading