brainy/test-all-with-memory.sh
David Snelling 4949b6a629 CHECKPOINT: Industry-standard 3-tier testing implemented
 MAJOR BREAKTHROUGH - Session 5 Success:
- Unit tests: 18/19 passing with mocked AI (<500MB RAM)
- Integration tests: Real AI models loading successfully
- Core features: Real embeddings, CRUD operations verified
- Architecture: All 11 augmentations, worker threads operational

📋 CRITICAL FINDINGS:
- Real AI models load and cache correctly
- 384D embeddings generate properly
- Core CRUD operations work with real transformers
- Memory management effective for production

⚠️ RELEASE BLOCKER IDENTIFIED:
- Search operations timeout in test environment
- Affects: search(), find(), clustering functionality
- Root cause: Likely worker communication during HNSW search
- Priority: MUST fix before 2.0.0 release

🎯 NEXT SESSION PRIORITIES:
1. Debug and fix search timeout issue
2. Verify search/find/clustering work in production
3. Final documentation cleanup
4. Release preparation

Confidence: 90% ready (pending search functionality verification)
2025-08-25 17:12:58 -07:00

73 lines
No EOL
2 KiB
Bash
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# Comprehensive test runner with proper memory management
# Runs ALL tests with adequate memory allocation
echo "🧠 Brainy 2.0 Complete Test Suite with Memory Management"
echo "========================================================="
echo ""
# Set environment for ALL tests
export NODE_OPTIONS='--max-old-space-size=16384'
export BRAINY_MODELS_PATH=./models
export BRAINY_ALLOW_REMOTE_MODELS=false
# Use our memory-optimized vitest config
export VITEST_CONFIG=./vitest.config.memory.ts
echo "📊 Configuration:"
echo " - Node heap: 16GB"
echo " - Models: Local only"
echo " - Tests: Sequential execution"
echo " - Timeout: 2 minutes per test"
echo ""
# Build first
echo "🔨 Building TypeScript..."
npm run build
if [ $? -ne 0 ]; then
echo "❌ Build failed! Fix TypeScript errors first."
exit 1
fi
echo "✅ Build successful"
echo ""
# Run all tests with memory config
echo "🧪 Running all tests..."
npm test -- --config ./vitest.config.memory.ts --reporter=verbose 2>&1 | tee full-test-output.log
# Extract summary
echo ""
echo "=========================================="
echo "📊 Test Summary"
echo "=========================================="
# Count results
PASSED=$(grep -c "✓" full-test-output.log 2>/dev/null || echo 0)
FAILED=$(grep -c "×" full-test-output.log 2>/dev/null || echo 0)
SKIPPED=$(grep -c "↓" full-test-output.log 2>/dev/null || echo 0)
echo "✅ Passed: $PASSED"
echo "❌ Failed: $FAILED"
echo "⏭️ Skipped: $SKIPPED"
echo "📊 Total: $((PASSED + FAILED + SKIPPED))"
echo ""
if [ $FAILED -eq 0 ]; then
echo "🎉 SUCCESS! All tests passed!"
echo ""
echo "Ready for release:"
echo " npm version patch"
echo " npm publish"
exit 0
else
echo "⚠️ $FAILED tests failed."
echo ""
echo "Common issues:"
echo "1. Out of memory → Increase NODE_OPTIONS"
echo "2. Timeout → Tests need more than 2 minutes"
echo "3. clearAll → Must use { force: true }"
echo ""
echo "Check full-test-output.log for details."
exit 1
fi