11import { expect } from 'chai' ;
22import { once } from 'events' ;
33import * as sinon from 'sinon' ;
4- import { Transform } from 'stream' ;
54import { inspect } from 'util' ;
65
76import {
@@ -16,7 +15,6 @@ import {
1615 type MongoClient ,
1716 MongoCursorExhaustedError ,
1817 MongoOperationTimeoutError ,
19- MongoServerError ,
2018 TimeoutContext
2119} from '../../mongodb' ;
2220import { clearFailPoint , configureFailPoint } from '../../tools/utils' ;
@@ -317,42 +315,6 @@ describe('class AbstractCursor', function () {
317315 } ) ;
318316 } ) ;
319317
320- describe ( 'transform stream error handling' , function ( ) {
321- let client : MongoClient ;
322- let collection : Collection ;
323- const docs = [ { count : 0 } ] ;
324-
325- beforeEach ( async function ( ) {
326- client = this . configuration . newClient ( ) ;
327-
328- collection = client . db ( 'abstract_cursor_integration' ) . collection ( 'test' ) ;
329-
330- await collection . insertMany ( docs ) ;
331- } ) ;
332-
333- afterEach ( async function ( ) {
334- await collection . deleteMany ( { } ) ;
335- await client . close ( ) ;
336- } ) ;
337-
338- it ( 'propagates errors to transform stream' , async function ( ) {
339- const transform = new Transform ( {
340- transform ( data , encoding , callback ) {
341- callback ( null , data ) ;
342- }
343- } ) ;
344-
345- // MongoServerError: unknown operator: $bar
346- const stream = collection . find ( { foo : { $bar : 25 } } ) . stream ( { transform } ) ;
347-
348- const error : Error | null = await new Promise ( resolve => {
349- stream . on ( 'error' , error => resolve ( error ) ) ;
350- stream . on ( 'end' , ( ) => resolve ( null ) ) ;
351- } ) ;
352- expect ( error ) . to . be . instanceof ( MongoServerError ) ;
353- } ) ;
354- } ) ;
355-
356318 describe ( 'cursor end state' , function ( ) {
357319 let client : MongoClient ;
358320 let cursor : FindCursor ;
0 commit comments