From cb36c868d4f13ed2420c5a6552abe8b3fa2dda23 Mon Sep 17 00:00:00 2001 From: Ben Silverman Date: Mon, 27 Jul 2020 17:32:19 -0400 Subject: [PATCH] #17 Config for jest-mongodb --- jest-mongodb-config.js | 12 ++++++++++++ src/setupTests.js | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 jest-mongodb-config.js diff --git a/jest-mongodb-config.js b/jest-mongodb-config.js new file mode 100644 index 00000000..eeebbc69 --- /dev/null +++ b/jest-mongodb-config.js @@ -0,0 +1,12 @@ +module.exports = { + mongodbMemoryServerOptions: { + instance: { + dbName: 'jest', + }, + binary: { + version: '4.0.3', + skipMD5: true, + }, + autoStart: false, + }, +}; diff --git a/src/setupTests.js b/src/setupTests.js index cb802709..84f17c0b 100644 --- a/src/setupTests.js +++ b/src/setupTests.js @@ -7,6 +7,12 @@ import '@testing-library/jest-dom/extend-expect'; +import fs from 'fs'; import fetchMock from 'jest-fetch-mock'; fetchMock.enableMocks(); + +afterAll(() => { + // Unlink config used in jest-mongodb + fs.unlink(`${process.cwd()}/globalConfig.json`, () => {}); +});