test: add vitest
* feature(root): add vitest and some basic tests * fix(test): after rebase + added referrars test and more sites * fix(test): test broken after rebase * fix(test): provide db url to make prisma happy * fix tests
This commit is contained in:
committed by
GitHub
parent
09c83ddeb4
commit
5445d6309e
27
vitest.shared.ts
Normal file
27
vitest.shared.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as path from 'node:path';
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export const getSharedVitestConfig = ({
|
||||
__dirname: dirname,
|
||||
}: { __dirname: string }) => {
|
||||
return defineConfig({
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(dirname, 'src'),
|
||||
},
|
||||
},
|
||||
test: {
|
||||
env: {
|
||||
// Not used, just so prisma is happy
|
||||
DATABASE_URL: 'postgresql://u:p@127.0.0.1:5432/db',
|
||||
},
|
||||
include: ['**/*.test.{js,mjs,cjs,ts,mts,cts,jsx,tsx}'],
|
||||
browser: {
|
||||
name: 'chromium',
|
||||
provider: 'playwright',
|
||||
headless: true,
|
||||
},
|
||||
fakeTimers: { toFake: undefined },
|
||||
},
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user