-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun-tests-github.sh
More file actions
executable file
·44 lines (34 loc) · 1.25 KB
/
run-tests-github.sh
File metadata and controls
executable file
·44 lines (34 loc) · 1.25 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
39
40
41
42
43
44
#!/bin/sh
# Function to print messages with timestamps
log_with_time() {
echo "[$(date '+%Y-%m-%d %H:%M:%S')] $1"
}
log_with_time "[INFO] Starting test execution script"
# Ensure local node binaries are available
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
export PATH="$SCRIPT_DIR/node_modules/.bin:$PATH"
# Print the current local time
log_with_time "[INFO] Current local time: $(date)"
# Print the current time in UTC
log_with_time "[INFO] Current time in UTC: $(date -u)"
# Check if Allure is installed
if ! command -v allure >/dev/null 2>&1; then
log_with_time "[ERROR] Allure is not installed. Please install it and try again."
exit 1
fi
# Check if Jest is installed
if ! command -v jest >/dev/null 2>&1; then
log_with_time "[ERROR] Jest is not installed. Please install it and try again."
exit 1
fi
# Run Jest tests
log_with_time "[INFO] Running Jest tests"
if ! jest; then
log_with_time "[WARNING] Jest tests failed, but continuing with the script"
fi
# Generate Allure report
log_with_time "[INFO] Generating Allure report"
if ! allure generate allure-results --clean -o allure-report; then
log_with_time "[ERROR] Failed to generate Allure report, but continuing with the script"
fi
log_with_time "[INFO] Test execution completed"