Skip to content

Commit

Permalink
Merge pull request #404 from tim-hoffmann/master
Browse files Browse the repository at this point in the history
refactor: replace uuid dependency for built in nodejs util
  • Loading branch information
vladgolubev authored Dec 1, 2022
2 parents 0b62582 + 0c709ff commit 7ebaa8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@
},
"dependencies": {
"debug": "4.3.4",
"mongodb-memory-server": "8.9.3",
"uuid": "8.3.2"
"mongodb-memory-server": "8.9.3"
},
"devDependencies": {
"@babel/cli": "7.19.3",
Expand Down
5 changes: 2 additions & 3 deletions src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import {readFileSync} from 'fs';
import type {EnvironmentContext} from '@jest/environment';
import type {JestEnvironmentConfig} from '@jest/environment';
import {MongoMemoryReplSet, MongoMemoryServer} from 'mongodb-memory-server';
import {randomUUID} from 'crypto';
import {getMongodbMemoryOptions} from './helpers';

const uuid = require('uuid');

// eslint-disable-next-line import/order
const debug = require('debug')('jest-mongodb:environment');

Expand Down Expand Up @@ -38,7 +37,7 @@ module.exports = class MongoEnvironment extends TestEnvironment {
this.global.__MONGO_URI__ = mongo.getUri();
}

this.global.__MONGO_DB_NAME__ = globalConfig.mongoDBName || uuid.v4();
this.global.__MONGO_DB_NAME__ = globalConfig.mongoDBName || randomUUID();

await super.setup();
}
Expand Down

0 comments on commit 7ebaa8b

Please sign in to comment.