mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +02:00
Yesterday's postinstall fix (\`d1d37749f\`) removed the \`|| true\` guards, which in turn exposed that \`pnpm run type-check\` at the root had been red for a long time but nobody noticed. Several per- package scripts were genuinely broken: - \`@mana/test-config\`: \`vitest.config.base.ts\` and \`.svelte.ts\` pass \`all: true\` to the coverage block. Vitest 4 removed that flag (including uncovered files is now the default), so tsc reports \`'all' does not exist in type 'CoverageOptions'\`. Removed both. - \`@mana/credits\`: \`tsconfig.json\` include glob had \`"src/**/*.svelte"\`, which makes tsc try to parse .svelte files as TS source. It can't. Removed .svelte from include; added \`"exclude": ["src/web/**"]\` — the web consumer layer is checked by svelte-check in the apps that import it, not here. - \`@mana/local-stt\` + \`@mana/local-llm\`: ship \`svelte.svelte.ts\` files that use Svelte 5 runes (\`$state\` etc.). Plain tsc has no rune support — \`$state\` is not a name it knows about. Both packages' \`type-check\` scripts now explicitly skip with a message pointing at svelte-check as the right tool. The rune code is still type-checked by svelte-check when a consumer app runs \`pnpm check\`. - \`@manavoxel/shared\`: was missing its \`tsconfig.json\` entirely, so the \`type-check\` script ran tsc with no config, which dumped the CLI help and exited non-zero. Added a minimal bundler-mode tsconfig matching the pattern used by sibling packages. \`pnpm run type-check\` now goes further than it has in months — next failure is a real pre-existing Hono type mismatch in \`services/mana-media/apps/api/src/routes/delivery.ts\` (Buffer vs c.body signature), which is out of scope here and needs a proper code fix, not a config fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| jest.config.backend.js | ||
| jest.config.mobile.js | ||
| package.json | ||
| playwright.config.base.ts | ||
| README.md | ||
| tsconfig.json | ||
| vitest.config.base.ts | ||
| vitest.config.svelte.ts | ||
@mana/test-config
Shared test configurations for all projects in the Mana monorepo.
Available Configurations
Jest Configuration for NestJS Backends
// jest.config.js
const baseConfig = require('@mana/test-config/jest-backend');
module.exports = {
...baseConfig,
// Your project-specific overrides
};
Jest Configuration for React Native Mobile
// jest.config.js
module.exports = {
preset: '@mana/test-config/jest-mobile',
// Your project-specific overrides
};
Vitest Configuration for Shared Packages
// vitest.config.ts
import { defineConfig, mergeConfig } from 'vitest/config';
import baseConfig from '@mana/test-config/vitest-base';
export default mergeConfig(
baseConfig,
defineConfig({
// Your project-specific overrides
})
);
Vitest Configuration for SvelteKit Web Apps
// vitest.config.ts
import { defineConfig, mergeConfig } from 'vitest/config';
import svelteConfig from '@mana/test-config/vitest-svelte';
import { sveltekit } from '@sveltejs/kit/vite';
export default mergeConfig(
svelteConfig,
defineConfig({
plugins: [sveltekit()],
// Your project-specific overrides
})
);
Playwright Configuration for E2E Tests
// playwright.config.ts
import { defineConfig } from '@playwright/test';
import baseConfig from '@mana/test-config/playwright';
export default defineConfig({
...baseConfig,
use: {
...baseConfig.use,
baseURL: 'http://localhost:5173',
},
// Your project-specific overrides
});
Features
Common Settings Across All Configs
- Coverage Thresholds: 80% for lines, functions, branches, statements
- Mock Management: Auto-clear, restore, and reset mocks between tests
- Timeout: 10s default for tests
- Verbose Output: In CI environments
- Error Handling: Fail on deprecated APIs
NestJS Backend Config
- TypeScript support via ts-jest
- Automatic exclusion of modules, DTOs, entities
- Module path aliases support
- Coverage collection from source files
React Native Mobile Config
- jest-expo preset
- Transform ignore patterns for React Native modules
- Support for @mana packages
- Coverage from src/ and app/ directories
Vitest Configs
- Modern, fast test runner
- Coverage via v8
- ESM support
- Global test APIs (describe, it, expect)
Playwright Config
- Multi-browser testing (Chromium, Firefox, WebKit)
- Mobile viewport testing
- Built-in retry logic
- Video/screenshot on failure
- Auto-start web server
Adding to Your Project
- Install peer dependencies:
# For NestJS backend
pnpm add -D jest ts-jest @types/jest
# For React Native mobile
pnpm add -D jest jest-expo @testing-library/react-native
# For SvelteKit web
pnpm add -D vitest @vitest/coverage-v8 jsdom
# For E2E tests
pnpm add -D @playwright/test
-
Create config file in your project root (see examples above)
-
Add test scripts to package.json:
{
"scripts": {
"test": "jest", // or "vitest run"
"test:watch": "jest --watch", // or "vitest"
"test:cov": "jest --coverage", // or "vitest run --coverage"
"test:e2e": "playwright test"
}
}
Customization
Each config can be extended with project-specific settings:
// Override coverage thresholds
export default mergeConfig(baseConfig, {
test: {
coverage: {
thresholds: {
lines: 90, // More strict for critical packages
},
},
},
});