-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.sh
More file actions
executable file
·38 lines (32 loc) · 1.08 KB
/
test.sh
File metadata and controls
executable file
·38 lines (32 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/bin/bash
# Function to run the test process
run_tests() {
# Build the project
./build.sh || { echo "❌ Build failed"; return 1; }
# Change to backend directory for tests
cd backend || { echo "❌ Failed to change to backend directory"; return 1; }
# Run e2e tests
echo "🧪 Running e2e tests..."
pnpm run test:e2e || { echo "❌ E2E tests failed"; return 1; }
echo "✅ E2e tests completed successfully"
# Change back to root directory
cd .. || { echo "❌ Failed to change to root directory"; return 1; }
echo "✨ Build and test process completed successfully"
return 0
}
# Check if --log parameter is present
if [[ "$*" == *"--log"* ]]; then
# Run tests with output redirected to log file
(run_tests) > last_test_run.log 2>&1
exit_code=$?
if [ $exit_code -eq 0 ]; then
echo "✨ Tests completed successfully. Check last_test_run.log for details."
else
echo "❌ Tests failed. Check last_test_run.log for details."
fi
exit $exit_code
else
# Run tests with normal output
run_tests
exit $?
fi