File tree Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Expand file tree Collapse file tree 1 file changed +4
-9
lines changed Original file line number Diff line number Diff line change 11import path from 'node:path'
22import 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'
54import { BASE_DATABASE_PATH } from './global-setup.ts'
65
76const databaseFile = `./tests/prisma/data.${ process . env . VITEST_POOL_ID || 0 } .db`
87const databasePath = path . join ( process . cwd ( ) , databaseFile )
98process . env . DATABASE_URL = `file:${ databasePath } `
109
11- beforeAll ( async ( ) => {
10+ beforeEach ( async ( ) => {
1211 await fsExtra . copyFile ( BASE_DATABASE_PATH , databasePath )
1312} )
1413
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-
2114afterAll ( async ( ) => {
15+ // we *must* use dynamic imports here so the process.env.DATABASE_URL is set
16+ // before prisma is imported and initialized
2217 const { prisma } = await import ( '#app/utils/db.server.ts' )
2318 await prisma . $disconnect ( )
2419 await fsExtra . remove ( databasePath )
You can’t perform that action at this time.
0 commit comments