@@ -461,16 +461,14 @@ function compareCommandStartedEvents(
461461 if ( expected ! . commandName ) {
462462 expect (
463463 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
466465 } `
467466 ) . to . equal ( actual . commandName ) ;
468467 }
469468 if ( expected ! . databaseName ) {
470469 expect (
471470 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
474472 } `
475473 ) . to . equal ( actual . databaseName ) ;
476474 }
@@ -488,8 +486,7 @@ function compareCommandSucceededEvents(
488486 if ( expected ! . commandName ) {
489487 expect (
490488 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
493490 } `
494491 ) . to . equal ( actual . commandName ) ;
495492 }
@@ -504,8 +501,7 @@ function compareCommandFailedEvents(
504501 if ( expected ! . commandName ) {
505502 expect (
506503 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
509505 } `
510506 ) . to . equal ( actual . commandName ) ;
511507 }
@@ -778,6 +774,10 @@ export function expectErrorCheck(
778774 if ( error instanceof MongoBulkWriteError ) {
779775 // TODO(NODE-6281): do not throw MongoServerErrors from bulk write if the error is a client-side error
780776 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 ) ;
781781 } else {
782782 expect ( error ) . not . to . be . instanceOf ( MongoServerError ) ;
783783 }
0 commit comments