@@ -461,16 +461,14 @@ function compareCommandStartedEvents(
461
461
if ( expected ! . commandName ) {
462
462
expect (
463
463
expected ! . commandName ,
464
- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
465
- actual . commandName
464
+ `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${ actual . commandName
466
465
} `
467
466
) . to . equal ( actual . commandName ) ;
468
467
}
469
468
if ( expected ! . databaseName ) {
470
469
expect (
471
470
expected ! . databaseName ,
472
- `expected ${ prefix } .databaseName to equal ${ expected ! . databaseName } but received ${
473
- actual . databaseName
471
+ `expected ${ prefix } .databaseName to equal ${ expected ! . databaseName } but received ${ actual . databaseName
474
472
} `
475
473
) . to . equal ( actual . databaseName ) ;
476
474
}
@@ -488,8 +486,7 @@ function compareCommandSucceededEvents(
488
486
if ( expected ! . commandName ) {
489
487
expect (
490
488
expected ! . commandName ,
491
- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
492
- actual . commandName
489
+ `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${ actual . commandName
493
490
} `
494
491
) . to . equal ( actual . commandName ) ;
495
492
}
@@ -504,8 +501,7 @@ function compareCommandFailedEvents(
504
501
if ( expected ! . commandName ) {
505
502
expect (
506
503
expected ! . commandName ,
507
- `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${
508
- actual . commandName
504
+ `expected ${ prefix } .commandName to equal ${ expected ! . commandName } but received ${ actual . commandName
509
505
} `
510
506
) . to . equal ( actual . commandName ) ;
511
507
}
@@ -778,6 +774,10 @@ export function expectErrorCheck(
778
774
if ( error instanceof MongoBulkWriteError ) {
779
775
// TODO(NODE-6281): do not throw MongoServerErrors from bulk write if the error is a client-side error
780
776
expect ( error . errorResponse ) . not . to . be . instanceOf ( MongoServerError ) ;
777
+ } else if ( inspect ( error , { depth : Infinity } ) . includes ( `StateMachine.markCommand` ) ) {
778
+ // mongocryptd marking commands results in MongoServerErrors because we communicate with a mongocryptd using a
779
+ // MongoClient. These are technically considered client errors though.
780
+ expect ( error ) . to . be . instanceOf ( MongoServerError ) ;
781
781
} else {
782
782
expect ( error ) . not . to . be . instanceOf ( MongoServerError ) ;
783
783
}
0 commit comments