Skip to content

Commit

Permalink
Merge pull request #407 from DevCycleHQ/fix-jest-projects-setup
Browse files Browse the repository at this point in the history
fix global setup and teardown for jest multi-project setups
  • Loading branch information
harazdovskiy authored Jan 20, 2023
2 parents bfacb3f + 42faf86 commit 0ece5e6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = class MongoEnvironment extends TestEnvironment {
globalConfigPath: string;
constructor(config: JestEnvironmentConfig, context: EnvironmentContext) {
super(config, context);
this.globalConfigPath = pathJoin(config.projectConfig.rootDir, 'globalConfig.json');
this.globalConfigPath = pathJoin(config.globalConfig.rootDir, 'globalConfig.json');
}

async setup() {
Expand Down
2 changes: 1 addition & 1 deletion src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const mongo: Mongo = isReplSet
? new MongoMemoryReplSet(mongoMemoryServerOptions)
: new MongoMemoryServer(mongoMemoryServerOptions);

module.exports = async (config: JestEnvironmentConfig['projectConfig']) => {
module.exports = async (config: JestEnvironmentConfig['globalConfig']) => {
const globalConfigPath = join(config.rootDir, 'globalConfig.json');

const options = getMongodbMemoryOptions();
Expand Down
2 changes: 1 addition & 1 deletion src/teardown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import type {JestEnvironmentConfig} from '@jest/environment';

const debug = require('debug')('jest-mongodb:teardown');

module.exports = async function (config: JestEnvironmentConfig['projectConfig']) {
module.exports = async function (config: JestEnvironmentConfig['globalConfig']) {
const globalConfigPath = join(config.rootDir, 'globalConfig.json');

debug('Teardown mongod');
Expand Down

0 comments on commit 0ece5e6

Please sign in to comment.