Skip to content

Commit e599372

Browse files
committed
feat(MongoInstance): change options to be readonly
BREAKING CHANGE: change "instanceOpts" to be readonly and Readonly change "binaryOpts" to be readonly and Readonly change "spawnOpts" to be readonly and Readonly
1 parent 03c8343 commit e599372

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

packages/mongodb-memory-server-core/src/util/MongoInstance.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,11 @@ export interface MongoInstance extends EventEmitter {
6464
* This Class starts & stops the "mongod" process directly and handles stdout, sterr and close events
6565
*/
6666
export class MongoInstance extends EventEmitter {
67-
instanceOpts: MongoInstanceOpts;
68-
binaryOpts: MongoBinaryOpts;
69-
spawnOpts: SpawnOptions;
67+
// Mark these values as "readonly" & "Readonly" because modifying them after starting will have no effect
68+
// readonly is required otherwise the property can still be changed on the root level
69+
readonly instanceOpts: Readonly<MongoInstanceOpts>;
70+
readonly binaryOpts: Readonly<MongoBinaryOpts>;
71+
readonly spawnOpts: Readonly<SpawnOptions>;
7072

7173
/**
7274
* The "mongod" Process reference

0 commit comments

Comments
 (0)