diff --git a/packages/effect-mongodb/test/support/describe-mongo.ts b/packages/effect-mongodb/test/support/describe-mongo.ts index 23da0ce..0460446 100644 --- a/packages/effect-mongodb/test/support/describe-mongo.ts +++ b/packages/effect-mongodb/test/support/describe-mongo.ts @@ -1,7 +1,7 @@ import * as Effect from "effect/Effect" import type { Db } from "mongodb" import { MongoClient } from "mongodb" -import { afterAll, beforeAll, beforeEach, describe, inject } from "vitest" +import { afterAll, beforeAll, describe, inject } from "vitest" type MongoContext = { client: Effect.Effect @@ -10,22 +10,25 @@ type MongoContext = { _database: () => Db } -export const describeMongo = (suiteName: string, tests: (ctx: MongoContext) => void) => { - describe.sequential(suiteName, () => { +export const describeMongo = ( + suiteName: string, + tests: (ctx: MongoContext) => void +) => { + describe(suiteName, () => { let client: MongoClient let database: Db let databaseName: string beforeAll(async () => { - client = new MongoClient(inject("mongoConnectionString"), { directConnection: true }) + client = new MongoClient(inject("mongoConnectionString"), { + directConnection: true + }) await client.connect() // https://www.mongodb.com/docs/v5.2/reference/limits/#mongodb-limit-Database-Name-Case-Sensitivity databaseName = suiteName.replace(/[/\\. "$*<>:|?]/g, "-") database = client.db(databaseName) - }) - beforeEach(async () => { const collections = await database.collections() await Promise.all(collections.map((x) => x.deleteMany({}))) })