mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 22: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>
93 lines
2.1 KiB
TypeScript
93 lines
2.1 KiB
TypeScript
/**
|
|
* Vitest configuration for SvelteKit web projects
|
|
*
|
|
* Usage in web 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 overrides
|
|
* })
|
|
* );
|
|
*/
|
|
|
|
import { defineConfig } from 'vitest/config';
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
// Test file patterns
|
|
include: ['src/**/*.{test,spec}.{js,ts}'],
|
|
|
|
// Exclude patterns
|
|
exclude: ['node_modules/**', 'e2e/**', 'build/**', '.svelte-kit/**', '**/*.d.ts'],
|
|
|
|
// Test environment for browser APIs
|
|
environment: 'jsdom',
|
|
|
|
// Global test APIs
|
|
globals: true,
|
|
|
|
// Setup files
|
|
setupFiles: ['./vitest.setup.ts'],
|
|
|
|
// Coverage configuration
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'json', 'html', 'lcov'],
|
|
include: ['src/**/*.{js,ts,svelte}'],
|
|
exclude: [
|
|
'**/*.d.ts',
|
|
'**/*.config.*',
|
|
'**/mockData/**',
|
|
'**/__tests__/**',
|
|
'**/node_modules/**',
|
|
'**/build/**',
|
|
'**/.svelte-kit/**',
|
|
'**/coverage/**',
|
|
'src/routes/**/+*.ts', // Exclude SvelteKit route files from coverage (tested via E2E)
|
|
'src/routes/**/+*.server.ts', // Test these explicitly
|
|
],
|
|
thresholds: {
|
|
lines: 80,
|
|
functions: 80,
|
|
branches: 80,
|
|
statements: 80,
|
|
},
|
|
// Vitest 4 removed `all: true` — including uncovered files in the
|
|
// report is now the default, so the option is gone.
|
|
},
|
|
|
|
// Test timeout
|
|
testTimeout: 10000,
|
|
|
|
// Hooks timeout
|
|
hookTimeout: 10000,
|
|
|
|
// Reporters
|
|
reporters: process.env.CI ? ['verbose', 'github-actions'] : ['verbose'],
|
|
|
|
// Mock reset
|
|
clearMocks: true,
|
|
mockReset: true,
|
|
restoreMocks: true,
|
|
|
|
// Browser mode (optional - for testing Svelte components in real browser)
|
|
// browser: {
|
|
// enabled: false, // Enable when needed
|
|
// name: 'chromium',
|
|
// provider: 'playwright',
|
|
// },
|
|
},
|
|
|
|
// Resolve aliases (adjust based on your SvelteKit config)
|
|
resolve: {
|
|
alias: {
|
|
$lib: '/src/lib',
|
|
$app: '/.svelte-kit/runtime/app',
|
|
},
|
|
},
|
|
});
|