Skip to content

Commit 7ebaa8b

Browse files
authored
Merge pull request #404 from tim-hoffmann/master
refactor: replace uuid dependency for built in nodejs util
2 parents 0b62582 + 0c709ff commit 7ebaa8b

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@
4949
},
5050
"dependencies": {
5151
"debug": "4.3.4",
52-
"mongodb-memory-server": "8.9.3",
53-
"uuid": "8.3.2"
52+
"mongodb-memory-server": "8.9.3"
5453
},
5554
"devDependencies": {
5655
"@babel/cli": "7.19.3",

src/environment.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import {readFileSync} from 'fs';
44
import type {EnvironmentContext} from '@jest/environment';
55
import type {JestEnvironmentConfig} from '@jest/environment';
66
import {MongoMemoryReplSet, MongoMemoryServer} from 'mongodb-memory-server';
7+
import {randomUUID} from 'crypto';
78
import {getMongodbMemoryOptions} from './helpers';
89

9-
const uuid = require('uuid');
10-
1110
// eslint-disable-next-line import/order
1211
const debug = require('debug')('jest-mongodb:environment');
1312

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

41-
this.global.__MONGO_DB_NAME__ = globalConfig.mongoDBName || uuid.v4();
40+
this.global.__MONGO_DB_NAME__ = globalConfig.mongoDBName || randomUUID();
4241

4342
await super.setup();
4443
}

0 commit comments

Comments
 (0)