-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathrun-all-tests.sh
More file actions
93 lines (77 loc) · 2.31 KB
/
run-all-tests.sh
File metadata and controls
93 lines (77 loc) · 2.31 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#!/bin/bash
# DigiByte Stats - Run All Tests Script
# This script runs all tests and generates a comprehensive report
echo "🧪 DigiByte Stats - Comprehensive Test Suite"
echo "==========================================="
echo ""
# Check if dependencies are installed
echo "📦 Checking dependencies..."
if ! npm list vitest >/dev/null 2>&1; then
echo "❌ Vitest not installed. Running npm install..."
npm install
fi
if ! npm list @playwright/test >/dev/null 2>&1; then
echo "❌ Playwright not installed. Running npm install..."
npm install
fi
echo "✅ Dependencies verified"
echo ""
# Run unit and integration tests with coverage
echo "🔬 Running Unit & Integration Tests with Coverage..."
echo "---------------------------------------------------"
npm run test:coverage
# Check if tests passed
if [ $? -ne 0 ]; then
echo "❌ Unit/Integration tests failed!"
exit 1
fi
echo ""
echo "✅ Unit & Integration tests passed!"
echo ""
# Run E2E tests
echo "🌐 Running E2E Tests..."
echo "----------------------"
npm run test:e2e
# Check if E2E tests passed
if [ $? -ne 0 ]; then
echo "❌ E2E tests failed!"
exit 1
fi
echo ""
echo "✅ E2E tests passed!"
echo ""
# Generate reports
echo "📊 Test Summary"
echo "==============="
echo ""
# Show coverage summary
echo "📈 Coverage Report:"
echo "-------------------"
if [ -f coverage/coverage-summary.json ]; then
node -e "
const coverage = require('./coverage/coverage-summary.json');
const total = coverage.total;
console.log(' Statements: ' + total.statements.pct + '%');
console.log(' Branches: ' + total.branches.pct + '%');
console.log(' Functions: ' + total.functions.pct + '%');
console.log(' Lines: ' + total.lines.pct + '%');
"
else
echo " Coverage report not found. Run 'npm run test:coverage' to generate."
fi
echo ""
echo "📄 Reports Generated:"
echo "--------------------"
echo " - Coverage HTML: coverage/index.html"
echo " - Playwright Report: playwright-report/index.html"
echo " - Test Results: test-results/results.json"
echo ""
# Success message
echo "🎉 All tests passed successfully!"
echo ""
echo "📖 For more information, see:"
echo " - Testing documentation: src/tests/README.md"
echo " - Project documentation: CLAUDE.md"
echo ""
# Make script executable
chmod +x run-all-tests.sh