@shelf/jest-mongodb
Version:
Run your tests using Jest & MongoDB in Memory server
19 lines (18 loc) • 509 B
JavaScript
;
var _path = require("path");
var _fs = require("fs");
const debug = require('debug')('jest-mongodb:teardown');
module.exports = async function (config) {
const globalConfigPath = (0, _path.join)(config.rootDir, 'globalConfig.json');
debug('Teardown mongod');
if (global.__MONGOD__) {
await global.__MONGOD__.stop();
}
(0, _fs.unlink)(globalConfigPath, err => {
if (err) {
debug('Config could not be deleted');
return;
}
debug('Config is deleted');
});
};