@shelf/jest-mongodb
Advanced tools
Comparing version 4.1.2 to 4.1.3
@@ -12,4 +12,2 @@ "use strict"; | ||
const debug = require('debug')('jest-mongodb:environment'); | ||
const cwd = process.cwd(); | ||
const globalConfigPath = (0, _path.join)(cwd, 'globalConfig.json'); | ||
const options = (0, _helpers.getMongodbMemoryOptions)(); | ||
@@ -22,6 +20,7 @@ const isReplSet = Boolean(options.replSet); | ||
super(config, context); | ||
this.globalConfigPath = (0, _path.join)(config.projectConfig.rootDir, 'globalConfig.json'); | ||
} | ||
async setup() { | ||
debug('Setup MongoDB Test Environment'); | ||
const globalConfig = JSON.parse((0, _fs.readFileSync)(globalConfigPath, 'utf-8')); | ||
const globalConfig = JSON.parse((0, _fs.readFileSync)(this.globalConfigPath, 'utf-8')); | ||
if (globalConfig.mongoUri) { | ||
@@ -28,0 +27,0 @@ this.global.__MONGO_URI__ = globalConfig.mongoUri; |
@@ -16,5 +16,4 @@ "use strict"; | ||
const mongo = isReplSet ? new _mongodbMemoryServer.MongoMemoryReplSet(mongoMemoryServerOptions) : new _mongodbMemoryServer.MongoMemoryServer(mongoMemoryServerOptions); | ||
const cwd = process.cwd(); | ||
const globalConfigPath = (0, _path.join)(cwd, 'globalConfig.json'); | ||
module.exports = async () => { | ||
module.exports = async config => { | ||
const globalConfigPath = (0, _path.join)(config.rootDir, 'globalConfig.json'); | ||
const options = (0, _helpers.getMongodbMemoryOptions)(); | ||
@@ -21,0 +20,0 @@ const mongoConfig = {}; |
@@ -6,5 +6,4 @@ "use strict"; | ||
const debug = require('debug')('jest-mongodb:teardown'); | ||
const cwd = process.cwd(); | ||
const globalConfigPath = (0, _path.join)(cwd, 'globalConfig.json'); | ||
module.exports = async function () { | ||
module.exports = async function (config) { | ||
const globalConfigPath = (0, _path.join)(config.rootDir, 'globalConfig.json'); | ||
debug('Teardown mongod'); | ||
@@ -11,0 +10,0 @@ if (global.__MONGOD__) { |
{ | ||
"name": "@shelf/jest-mongodb", | ||
"version": "4.1.2", | ||
"version": "4.1.3", | ||
"private": false, | ||
@@ -59,14 +59,14 @@ "description": "Run your tests using Jest & MongoDB in Memory server", | ||
"@shelf/babel-config": "1.2.0", | ||
"@shelf/eslint-config": "2.22.0", | ||
"@shelf/eslint-config": "2.22.3", | ||
"@shelf/prettier-config": "1.0.0", | ||
"@shelf/tsconfig": "0.0.8", | ||
"@types/jest": "28.1.7", | ||
"@types/jest": "29.2.0", | ||
"@types/node": "16", | ||
"eslint": "8.23.0", | ||
"eslint": "8.26.0", | ||
"husky": "8.0.1", | ||
"jest": "28.1.3", | ||
"jest": "29.2.1", | ||
"lint-staged": "13.0.3", | ||
"mongodb": "4.9.1", | ||
"prettier": "2.7.1", | ||
"typescript": "4.7.4" | ||
"typescript": "4.8.4" | ||
}, | ||
@@ -73,0 +73,0 @@ "peerDependencies": { |
14853
185