Comprehensive self-hosted testing platform
npm install @testfn/corebash
npm install testfn
`
Quick Start
$3
`typescript
import { testFn } from 'testfn';
const runner = testFn({
framework: 'vitest',
testPattern: './tests/*/.test.ts',
parallel: 4
});
await runner.run();
`
$3
`typescript
import { testFn } from 'testfn';
const runner = testFn({
framework: 'playwright',
testPattern: './e2e/*/.spec.ts',
storage: {
type: 'indexeddb',
dbName: 'my-app-tests',
retentionDays: 30
}
});
const results = await runner.run();
console.log(Pass rate: ${results.summary.passed / results.summary.total});
`
$3
`typescript
import { testFn } from 'testfn';
const runner = testFn({
framework: 'playwright',
browsers: ['chromium', 'firefox', 'webkit'],
parallel: 6,
storage: {
type: 'indexeddb',
dbName: 'cross-browser-tests'
}
});
await runner.run();
`
Configuration
$3
`typescript
interface TestFnConfig {
framework: 'vitest' | 'playwright' | 'jest' | 'puppeteer';
testPattern?: string | string[];
parallel?: number | 'auto';
timeout?: number;
retries?: number;
env?: Record;
browsers?: BrowserType[] | BrowserConfig[];
storage?: StorageConfig;
visual?: VisualTestConfig;
reporters?: Reporter[];
onProgress?: (progress: TestProgress) => void;
onComplete?: (results: TestResults) => void;
}
`
$3
`typescript
interface StorageConfig {
type: 'indexeddb' | 'file' | 'db';
dbName?: string;
adapter?: unknown;
retentionDays?: number;
}
`
API Reference
$3
Creates a new test runner instance with the specified configuration.
$3
#### async run(): Promise
Executes the test suite and returns results.
#### setAdapter(adapter: TestFrameworkAdapter): void
Sets a custom framework adapter.
$3
#### async saveRun(run: TestRun): Promise
Saves a complete test run to storage.
#### async getRecentRuns(limit: number): Promise
Retrieves the most recent test runs.
#### async getTestHistory(testId: string, limit: number): Promise
Gets historical results for a specific test.
Project Status
Version: 0.1.0 (V0 Implementation)
Status: Active Development
$3
- ✅ Core type system (248 lines)
- ✅ IndexedDB storage layer with retention
- ✅ Test runner with parallel execution
- ✅ Worker pool for true parallelism
- ✅ Retry logic with automatic retries
- ✅ Framework adapters: Vitest, Playwright, Jest
- ✅ Multi-browser testing (Chromium, Firefox, WebKit)
- ✅ Analytics engine (metrics, flaky detection, regressions)
- ✅ Visual testing with pixel diff
- ✅ Reporters: Console, JSON, HTML Dashboard
- ✅ Storage facade with CRUD operations
- ✅ 5 comprehensive examples
$3
- 🚧 SSIM visual comparison
- 🚧 File system storage backend
- 🚧 Puppeteer adapter
$3
See SPEC.md for the complete V0 specification and development roadmap.
Architecture
`
testfn/
├── src/
│ ├── core/ # Test runner and orchestration
│ ├── storage/ # IndexedDB and storage adapters
│ ├── analytics/ # Metrics and flaky detection
│ ├── reporters/ # Console, JSON, HTML reporters
│ ├── visual/ # Screenshot comparison
│ ├── integrations/ # Framework adapters
│ └── types.ts # Core type definitions
└── examples/ # Usage examples
`
Examples
Check the examples/` directory for more usage patterns.