forked from mirror/crumbs-original
Adds src/lib/utils/theme.svelte.ts with applyTheme() (sets data-theme attribute and meta theme-color) and getIsDarkMode(). Uses a plain variable instead of $state since Vitest's node environment does not compile Svelte 5 runes in .svelte.ts files. Adds jsdom dev dependency and $app/environment alias in vitest config to support DOM-level unit tests; fixes preferences.test.ts to include the theme default added in Task 2. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 lines
559 B
TypeScript
23 lines
559 B
TypeScript
import { defineConfig } from 'vitest/config';
|
|
import path from 'path';
|
|
|
|
export default defineConfig({
|
|
resolve: {
|
|
alias: {
|
|
$lib: path.resolve(__dirname, 'src/lib'),
|
|
'$app/environment': path.resolve(__dirname, 'src/lib/__mocks__/app-environment.ts')
|
|
}
|
|
},
|
|
test: {
|
|
include: ['src/**/*.test.ts'],
|
|
environment: 'node',
|
|
coverage: {
|
|
provider: 'v8',
|
|
reporter: ['text', 'html', 'lcov', 'json-summary'],
|
|
reportsDirectory: './coverage/unit',
|
|
include: ['src/lib/**/*.ts'],
|
|
exclude: ['src/lib/**/*.test.ts', 'src/lib/types/**']
|
|
}
|
|
}
|
|
});
|