chore: make sure MongoDbMock is using the same configuration (@fehmer) (#5792)

This commit is contained in:
Christian Fehmer 2024-08-20 14:56:18 +02:00 committed by GitHub
parent 4466acd6bc
commit b48854bc9d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 10 deletions

View file

@ -1,15 +1,17 @@
import * as MongoDbMock from "vitest-mongodb";
export async function setup(): Promise<void> {
process.env.TZ = "UTC";
await MongoDbMock.setup({
serverOptions: {
binary: {
version: "6.0.12",
},
},
});
await MongoDbMock.setup(MongoDbMockConfig);
}
export async function teardown(): Promise<void> {
await MongoDbMock.teardown();
}
export const MongoDbMockConfig = {
serverOptions: {
binary: {
version: "6.0.12",
},
},
};

View file

@ -1,6 +1,7 @@
import { Collection, Db, MongoClient, WithId } from "mongodb";
import { afterAll, beforeAll, afterEach } from "vitest";
import * as MongoDbMock from "vitest-mongodb";
import { MongoDbMockConfig } from "./global-setup";
process.env["MODE"] = "dev";
//process.env["MONGOMS_DISTRO"] = "ubuntu-22.04";
@ -15,9 +16,8 @@ let client: MongoClient;
const collectionsForCleanUp = ["users"];
beforeAll(async () => {
await MongoDbMock.setup({
//don't add any configuration here, add to global-setup.ts instead.
});
//don't add any configuration here, add to global-setup.ts instead.
await MongoDbMock.setup(MongoDbMockConfig);
client = new MongoClient(globalThis.__MONGO_URI__);
await client.connect();