@@ -18,7 +18,7 @@ import {
1818 * @property {boolean } auth enable auth; (default: false)
1919 * @property {string[] } args additional command line args passed to `mongod`
2020 * @property {number } count number of `mongod` servers to start (default: 1)
21- * @property {string } dbName database name used in connection string
21+ * @property {string } dbName database name used in connection string (default: uuid)
2222 * @property {string } ip bind to all IP addresses specify `::,0.0.0.0`; (default '127.0.0.1')
2323 * @property {string } name replSet name (default: 'testset')
2424 * @property {number } oplogSize oplog size (in MB); (default: 1)
@@ -28,7 +28,7 @@ export interface ReplSetOpts {
2828 auth ?: boolean ;
2929 args ?: string [ ] ;
3030 count ?: number ;
31- dbName : string ;
31+ dbName ? : string ;
3232 ip ?: string ;
3333 name ?: string ;
3434 oplogSize ?: number ;
@@ -46,23 +46,30 @@ export interface MongoMemoryReplSetConfigSettingsT {
4646}
4747
4848export interface MongoMemoryReplSetOptsT {
49- instanceOpts : MongoMemoryInstancePropBaseT [ ] ;
50- binary : MongoBinaryOpts ;
51- replSet : ReplSetOpts ;
49+ instanceOpts ? : MongoMemoryInstancePropBaseT [ ] ;
50+ binary ? : MongoBinaryOpts ;
51+ replSet ? : ReplSetOpts ;
5252 autoStart ?: boolean ;
5353 debug ?: boolean ;
5454}
5555
5656export default class MongoMemoryReplSet extends EventEmitter {
5757 servers : MongoMemoryServer [ ] = [ ] ;
58- opts : MongoMemoryReplSetOptsT ;
58+ opts : {
59+ instanceOpts : MongoMemoryInstancePropBaseT [ ] ;
60+ binary : MongoBinaryOpts ;
61+ replSet : Required < ReplSetOpts > ;
62+ debug : boolean ;
63+ autoStart ?: boolean ;
64+ } ;
65+
5966 debug : DebugFn ;
6067 _state : 'init' | 'running' | 'stopped' ;
6168 admin ?: mongodb . Admin ;
6269
63- constructor ( opts : Partial < MongoMemoryReplSetOptsT > = { } ) {
70+ constructor ( opts : MongoMemoryReplSetOptsT = { } ) {
6471 super ( ) ;
65- const replSetDefaults : ReplSetOpts = {
72+ const replSetDefaults : Required < ReplSetOpts > = {
6673 auth : false ,
6774 args : [ ] ,
6875 name : 'testset' ,
@@ -72,6 +79,7 @@ export default class MongoMemoryReplSet extends EventEmitter {
7279 oplogSize : 1 ,
7380 spawn : { } ,
7481 storageEngine : 'ephemeralForTest' ,
82+ configSettings : { } ,
7583 } ;
7684 this . _state = 'stopped' ;
7785 this . opts = {
0 commit comments