-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Expand file tree
/
Copy pathrun-tests.sh
More file actions
82 lines (67 loc) · 3.58 KB
/
run-tests.sh
File metadata and controls
82 lines (67 loc) · 3.58 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
#!/bin/bash
# Multi-Chain Mini App Test Runner
# This script installs dependencies and runs all tests
set -e # Exit on error
BLUE='\033[0;34m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
NC='\033[0m' # No Color
echo -e "${BLUE}╔══════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ Eliza Multi-Chain Mini App - Test Runner ║${NC}"
echo -e "${BLUE}╚══════════════════════════════════════════════════════╝${NC}"
echo ""
# Navigate to project directory
cd "$(dirname "$0")"
PROJECT_DIR=$(pwd)
echo -e "${BLUE}📂 Project: ${PROJECT_DIR}${NC}"
echo ""
# Check if node_modules exists
if [ ! -d "node_modules" ]; then
echo -e "${YELLOW}📦 Installing dependencies...${NC}"
npm install
echo -e "${GREEN}✅ Dependencies installed${NC}"
echo ""
else
echo -e "${GREEN}✅ Dependencies already installed${NC}"
echo ""
fi
# Run TypeScript check
echo -e "${BLUE}🔍 Checking TypeScript types...${NC}"
npx tsc --noEmit --skipLibCheck 2>&1 | head -20 || echo -e "${YELLOW}⚠️ Some TypeScript warnings (non-critical)${NC}"
echo ""
# Run tests with mocks (default)
echo -e "${BLUE}╔══════════════════════════════════════════════════════╗${NC}"
echo -e "${BLUE}║ Running Tests (Mock Mode) ║${NC}"
echo -e "${BLUE}╚══════════════════════════════════════════════════════╝${NC}"
echo ""
# Run vitest
npm test -- --run --reporter=verbose 2>&1
TEST_EXIT_CODE=$?
echo ""
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo -e "${GREEN}╔══════════════════════════════════════════════════════╗${NC}"
echo -e "${GREEN}║ ✅ ALL TESTS PASSED! ✅ ║${NC}"
echo -e "${GREEN}╚══════════════════════════════════════════════════════╝${NC}"
echo ""
# Generate coverage
echo -e "${BLUE}📊 Generating coverage report...${NC}"
npm run test:coverage -- --run 2>&1 || echo -e "${YELLOW}Coverage generation skipped${NC}"
echo ""
echo -e "${GREEN}🎉 Test suite complete!${NC}"
echo ""
echo -e "${BLUE}Next steps:${NC}"
echo -e " • View coverage: ${YELLOW}open coverage/index.html${NC}"
echo -e " • Build app: ${YELLOW}npm run build${NC}"
echo -e " • Start dev: ${YELLOW}npm run dev${NC}"
else
echo -e "${RED}╔══════════════════════════════════════════════════════╗${NC}"
echo -e "${RED}║ ❌ SOME TESTS FAILED ❌ ║${NC}"
echo -e "${RED}╚══════════════════════════════════════════════════════╝${NC}"
echo ""
echo -e "${YELLOW}Troubleshooting:${NC}"
echo -e " • Run in UI mode: ${YELLOW}npm run test:ui${NC}"
echo -e " • Check logs above for details"
echo -e " • See __tests__/README.md for help"
exit 1
fi