File tree 1 file changed +4
-9
lines changed
1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 1
1
import path from 'node:path'
2
2
import fsExtra from 'fs-extra'
3
- import { afterAll , afterEach , beforeAll } from 'vitest'
4
- import { cleanupDb } from '#tests/db-utils.ts'
3
+ import { afterAll , beforeEach } from 'vitest'
5
4
import { BASE_DATABASE_PATH } from './global-setup.ts'
6
5
7
6
const databaseFile = `./tests/prisma/data.${ process . env . VITEST_POOL_ID || 0 } .db`
8
7
const databasePath = path . join ( process . cwd ( ) , databaseFile )
9
8
process . env . DATABASE_URL = `file:${ databasePath } `
10
9
11
- beforeAll ( async ( ) => {
10
+ beforeEach ( async ( ) => {
12
11
await fsExtra . copyFile ( BASE_DATABASE_PATH , databasePath )
13
12
} )
14
13
15
- // we *must* use dynamic imports here so the process.env.DATABASE_URL is set
16
- // before prisma is imported and initialized
17
- afterEach ( async ( ) => {
18
- await cleanupDb ( )
19
- } )
20
-
21
14
afterAll ( async ( ) => {
15
+ // we *must* use dynamic imports here so the process.env.DATABASE_URL is set
16
+ // before prisma is imported and initialized
22
17
const { prisma } = await import ( '#app/utils/db.server.ts' )
23
18
await prisma . $disconnect ( )
24
19
await fsExtra . remove ( databasePath )
You can’t perform that action at this time.
0 commit comments