brainy/examples/brainy-service-template/tests/setup.js
David Snelling ee003a9473 feat: add zero-configuration Brainy service template with augmentation-first architecture
- Implement WebSocket augmentation for real-time communication
- Implement WebRTC augmentation for peer-to-peer connections
- Implement HTTP augmentation as minimal REST fallback
- Add auto-discovery augmentation for data pattern analysis
- Add adaptive storage augmentation for intelligent resource management
- Add environment adapter augmentation for universal compatibility
- Template auto-detects environment (browser, Node.js, serverless, containers)
- Intelligent transport selection (WebRTC → WebSocket → HTTP)
- Automatic storage optimization (memory → filesystem → S3)
- Zero configuration required - just npm start
- Includes intelligent verb scoring by default
- Works in any environment without configuration
- Full documentation and examples included
2025-08-06 18:17:32 -07:00

33 lines
No EOL
828 B
JavaScript

import { beforeAll, afterAll } from 'vitest'
import config from 'config'
// Global test setup
beforeAll(async () => {
// Set test environment
process.env.NODE_ENV = 'test'
process.env.LOG_LEVEL = 'error'
// Suppress console output during tests
const originalConsoleLog = console.log
const originalConsoleWarn = console.warn
console.log = (...args) => {
if (!args[0]?.includes?.('Model loaded') && !args[0]?.includes?.('Brainy')) {
originalConsoleLog.apply(console, args)
}
}
console.warn = (...args) => {
if (!args[0]?.includes?.('Model') && !args[0]?.includes?.('TensorFlow')) {
originalConsoleWarn.apply(console, args)
}
}
})
afterAll(async () => {
// Cleanup any global resources
// Force garbage collection if available
if (global.gc) {
global.gc()
}
})