TypeFetched/tests/minimal-debug.ts
Casey Collier b85b9a63e2 Initial commit: TypedFetch - Zero-dependency, type-safe HTTP client
Features:
- Zero configuration, just works out of the box
- Runtime type inference and validation
- Built-in caching with W-TinyLFU algorithm
- Automatic retries with exponential backoff
- Circuit breaker for resilience
- Request deduplication
- Offline support with queue
- OpenAPI schema discovery
- Full TypeScript support with type descriptors
- Modular architecture
- Configurable for advanced use cases

Built with bun, ready for npm publishing
2025-07-20 12:35:43 -04:00

45 lines
No EOL
1.3 KiB
TypeScript

#!/usr/bin/env bun
console.log('Minimal Debug Test')
// Test basic fetch first
console.log('\n1. Testing raw fetch...')
try {
const response = await fetch('https://api.github.com/users/torvalds')
const data = await response.json()
console.log('✅ Raw fetch works:', data.login)
} catch (error) {
console.error('❌ Raw fetch failed:', error)
}
// Test the revolutionary module
console.log('\n2. Testing revolutionary module...')
try {
const { tf } = await import('../src/index.js')
console.log('✅ Module imported')
// Add temporary debug logging
const originalFetch = global.fetch
let fetchCallCount = 0
global.fetch = async (...args) => {
console.log(` [DEBUG] fetch called #${++fetchCallCount}:`, args[0])
const result = await originalFetch(...args)
console.log(` [DEBUG] fetch returned status:`, result.status)
return result
}
console.log('\n3. Calling tf.get...')
try {
const result = await tf.get('https://api.github.com/users/torvalds')
console.log('✅ tf.get succeeded:', result.data?.login)
} catch (error) {
console.error('❌ tf.get failed:', error)
console.error('Stack:', error.stack)
}
// Restore original fetch
global.fetch = originalFetch
} catch (error) {
console.error('❌ Module import failed:', error)
}