Files
convex-monorepo/tools/vitest/index.ts
T

25 lines
760 B
TypeScript

import { fileURLToPath } from 'node:url';
import react from '@vitejs/plugin-react';
import { defineProject } from 'vitest/config';
const jsdomSetup = fileURLToPath(new URL('./setup-jsdom.ts', import.meta.url));
export const nodeProject = (name: string, include: string[]) =>
defineProject({ test: { name, environment: 'node', include } });
export const jsdomProject = (name: string, include: string[]) =>
defineProject({
plugins: [react()],
test: { name, environment: 'jsdom', include, setupFiles: [jsdomSetup] },
});
export const convexProject = (name: string, include: string[]) =>
defineProject({
test: {
name,
environment: 'edge-runtime',
include,
server: { deps: { inline: ['convex-test'] } },
},
});