@@ -5,6 +5,7 @@ import * as url from 'url';
55
66import {
77 type AuthMechanism ,
8+ CompressorName ,
89 HostAddress ,
910 MongoClient ,
1011 type MongoClientOptions ,
@@ -85,6 +86,7 @@ export class TestConfiguration {
8586 serverApi ?: ServerApi ;
8687 activeResources : number ;
8788 isSrv : boolean ;
89+ compressors : CompressorName [ ] ;
8890
8991 constructor (
9092 private uri : string ,
@@ -116,11 +118,11 @@ export class TestConfiguration {
116118 replicaSet : url . searchParams . get ( 'replicaSet' ) ,
117119 proxyURIParams : url . searchParams . get ( 'proxyHost' )
118120 ? {
119- proxyHost : url . searchParams . get ( 'proxyHost' ) ,
120- proxyPort : Number ( url . searchParams . get ( 'proxyPort' ) ) ,
121- proxyUsername : url . searchParams . get ( 'proxyUsername' ) ,
122- proxyPassword : url . searchParams . get ( 'proxyPassword' )
123- }
121+ proxyHost : url . searchParams . get ( 'proxyHost' ) ,
122+ proxyPort : Number ( url . searchParams . get ( 'proxyPort' ) ) ,
123+ proxyUsername : url . searchParams . get ( 'proxyUsername' ) ,
124+ proxyPassword : url . searchParams . get ( 'proxyPassword' )
125+ }
124126 : undefined
125127 } ;
126128 if ( url . username ) {
@@ -133,6 +135,7 @@ export class TestConfiguration {
133135 const { username, password } = context . serverlessCredentials ;
134136 this . options . auth = { username, password, authSource : 'admin' } ;
135137 }
138+ this . compressors = url . searchParams . getAll ( 'compressors' ) as CompressorName [ ] ;
136139 }
137140
138141 get isLoadBalanced ( ) {
@@ -197,7 +200,8 @@ export class TestConfiguration {
197200 }
198201
199202 newClient ( urlOrQueryOptions ?: string | Record < string , any > , serverOptions ?: MongoClientOptions ) {
200- serverOptions = Object . assign ( { } , getEnvironmentalOptions ( ) , serverOptions ) ;
203+ const baseOptions = this . compressors . length > 0 ? { compressors : this . compressors } : { }
204+ serverOptions = Object . assign ( baseOptions , getEnvironmentalOptions ( ) , serverOptions ) ;
201205 // Support MongoClient constructor form (url, options) for `newClient`.
202206 if ( typeof urlOrQueryOptions === 'string' ) {
203207 if ( Reflect . has ( serverOptions , 'host' ) || Reflect . has ( serverOptions , 'port' ) ) {
0 commit comments