Testing
Lakea uses Vitest for testing. The infrastructure is configured and ready, with tests being added incrementally.
Test Infrastructure
Section titled “Test Infrastructure”Each package has Vitest configured in its vite.config.ts:
export default defineConfig(() => ({ test: { name: '@lakea/core', watch: false, globals: true, environment: 'node', include: ['{src,tests}/**/*.{test,spec}.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'], reporters: ['default'], coverage: { reportsDirectory: './test-output/vitest/coverage', provider: 'v8', } },}));File Naming
Section titled “File Naming”Test files use .spec.ts or .test.ts suffix and are co-located with source:
packages/core/src/├── types/│ ├── index.ts│ └── index.spec.ts # Tests next to source├── data-fetchers/│ └── nasa/│ ├── exoplanetArchive.ts│ └── exoplanetArchive.spec.tsEach package also has a tsconfig.spec.json for test-specific TypeScript settings.
Running Tests
Section titled “Running Tests”# Test a specific packagepnpm nx test @lakea/core
# Test all affected packages (changed since main)pnpm nx affected -t test
# Test with watch modepnpm nx test @lakea/core --watch
# Test with coveragepnpm nx test @lakea/core --coverageConfiguration Files
Section titled “Configuration Files”| File | Purpose |
|---|---|
vite.config.ts | Vitest configuration per package |
tsconfig.spec.json | TypeScript settings for tests |
vitest.workspace.ts | Root workspace configuration |
Environment
Section titled “Environment”- Packages (
core,design-system,ui): Useenvironment: 'node' - Apps (if testing UI): Would use
environment: 'jsdom'
Current State
Section titled “Current State”Test infrastructure is ready. Tests are being added as features are developed. When contributing:
- Add tests for new functions in
@lakea/core - Place test files next to source files
- Run
pnpm nx affected -t testbefore submitting PRs