forked from isomorphic-git/isomorphic-git
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun-all-tests.sh
More file actions
executable file
·60 lines (47 loc) · 1.23 KB
/
run-all-tests.sh
File metadata and controls
executable file
·60 lines (47 loc) · 1.23 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
#!/bin/bash
# Run all tests with required infrastructure
echo "🚀 Starting test infrastructure..."
# Start CORS proxy on port 9999
echo "Starting CORS proxy on port 9999..."
npx nps proxy.start &
PROXY_PID=$!
# Start Git HTTP mock server on port 8888
echo "Starting Git HTTP mock server on port 8888..."
npx nps gitserver.start &
SERVER_PID=$!
# Wait for servers to be ready
echo "Waiting for servers to start..."
sleep 3
# Verify servers are running
if ! lsof -i:9999 > /dev/null 2>&1; then
echo "❌ CORS proxy failed to start on port 9999"
kill $PROXY_PID $SERVER_PID 2>/dev/null
exit 1
fi
if ! lsof -i:8888 > /dev/null 2>&1; then
echo "❌ Git mock server failed to start on port 8888"
kill $PROXY_PID $SERVER_PID 2>/dev/null
exit 1
fi
echo "✅ Servers ready!"
echo ""
echo "📊 Running all tests..."
echo ""
# Run tests
npx jest --no-coverage
# Capture exit code
TEST_EXIT_CODE=$?
# Cleanup
echo ""
echo "🧹 Stopping servers..."
npx nps proxy.stop
npx nps gitserver.stop
# Additional cleanup (kill any remaining processes)
kill $PROXY_PID $SERVER_PID 2>/dev/null
echo ""
if [ $TEST_EXIT_CODE -eq 0 ]; then
echo "✅ All tests passed!"
else
echo "❌ Some tests failed (exit code: $TEST_EXIT_CODE)"
fi
exit $TEST_EXIT_CODE