AFFiNE/vitest.config.ts

48 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-03-20 03:45:40 +03:00
import { resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
import react from '@vitejs/plugin-react';
2023-02-17 05:43:52 +03:00
import { defineConfig } from 'vitest/config';
const rootDir = fileURLToPath(new URL('.', import.meta.url));
2023-02-17 05:43:52 +03:00
export default defineConfig({
plugins: [react(), vanillaExtractPlugin()],
assetsInclude: ['**/*.md'],
resolve: {
alias: {
'next/router': 'next-router-mock',
'next/config': resolve(rootDir, './scripts/vitest/next-config-mock.ts'),
},
},
2023-02-17 05:43:52 +03:00
test: {
setupFiles: [
resolve(rootDir, './scripts/setup/lit.ts'),
resolve(rootDir, './scripts/setup/i18n.ts'),
resolve(rootDir, './scripts/setup/search.ts'),
resolve(rootDir, './scripts/setup/lottie-web.ts'),
],
// split tests that include native addons or not
include: process.env.NATIVE_TEST
? ['apps/electron/layers/**/*.spec.ts']
: [
'packages/**/*.spec.ts',
'packages/**/*.spec.tsx',
'apps/web/**/*.spec.ts',
'apps/web/**/*.spec.tsx',
'tests/unit/**/*.spec.ts',
'tests/unit/**/*.spec.tsx',
],
2023-04-25 02:53:36 +03:00
exclude: ['**/node_modules', '**/dist', '**/build', '**/out'],
2023-02-17 05:43:52 +03:00
testTimeout: 5000,
singleThread: Boolean(process.env.NATIVE_TEST),
threads: !process.env.NATIVE_TEST,
2023-02-17 05:43:52 +03:00
coverage: {
provider: 'istanbul', // or 'c8'
reporter: ['lcov'],
reportsDirectory: '.coverage/store',
},
},
});