@@ -51,6 +51,7 @@ describe('CliRepl', function () {
5151 const tmpdir = useTmpdir ( ) ;
5252
5353 async function log ( ) : Promise < any [ ] > {
54+ if ( ! cliRepl . logWriter ?. logFilePath ) return [ ] ;
5455 await cliRepl . logWriter . flush ( ) ; // Ensure any pending data is written first
5556 return readReplLogfile ( cliRepl . logWriter . logFilePath ) ;
5657 }
@@ -76,8 +77,8 @@ describe('CliRepl', function () {
7677 } ) ;
7778 exitCode = null ;
7879
79- let resolveExitPromise ;
80- exitPromise = new Promise ( ( resolve ) => {
80+ let resolveExitPromise ! : ( ) => void ;
81+ exitPromise = new Promise < void > ( ( resolve ) => {
8182 resolveExitPromise = resolve ;
8283 } ) ;
8384
@@ -858,7 +859,7 @@ describe('CliRepl', function () {
858859 try {
859860 await cliRepl . start ( '' , { } ) ;
860861 expect . fail ( 'missed exception' ) ;
861- } catch ( err ) {
862+ } catch ( err : any ) {
862863 expect ( err . message ) . to . equal ( 'nested error' ) ;
863864 }
864865 } ) ;
@@ -869,7 +870,7 @@ describe('CliRepl', function () {
869870 try {
870871 await cliRepl . start ( '' , { } ) ;
871872 expect . fail ( 'missed exception' ) ;
872- } catch ( err ) {
873+ } catch ( err : any ) {
873874 expect ( err . message ) . to . equal (
874875 'Cannot use --json without --eval or with --shell or with extra files'
875876 ) ;
@@ -884,7 +885,7 @@ describe('CliRepl', function () {
884885 try {
885886 await cliRepl . start ( '' , { } ) ;
886887 expect . fail ( 'missed exception' ) ;
887- } catch ( err ) {
888+ } catch ( err : any ) {
888889 expect ( err . message ) . to . equal (
889890 'Cannot use --json without --eval or with --shell or with extra files'
890891 ) ;
@@ -899,7 +900,7 @@ describe('CliRepl', function () {
899900 try {
900901 await cliRepl . start ( '' , { } ) ;
901902 expect . fail ( 'missed exception' ) ;
902- } catch ( err ) {
903+ } catch ( err : any ) {
903904 expect ( err . message ) . to . equal (
904905 'Cannot use --json without --eval or with --shell or with extra files'
905906 ) ;
@@ -1285,7 +1286,7 @@ describe('CliRepl', function () {
12851286 it ( 'does not emit warnings when connecting multiple times' , async function ( ) {
12861287 await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
12871288 let warnings = 0 ;
1288- const warningListener = ( warning ) => {
1289+ const warningListener = ( warning : unknown ) => {
12891290 console . log ( 'Unexpected warning' , warning ) ;
12901291 warnings ++ ;
12911292 } ;
@@ -1407,7 +1408,9 @@ describe('CliRepl', function () {
14071408 input . write ( 'exit\n' ) ;
14081409 await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
14091410 const useEvents = requests . flatMap ( ( req ) =>
1410- JSON . parse ( req . body ) . batch . filter ( ( entry ) => entry . event === 'Use' )
1411+ JSON . parse ( req . body ) . batch . filter (
1412+ ( entry : any ) => entry . event === 'Use'
1413+ )
14111414 ) ;
14121415 expect ( useEvents ) . to . have . lengthOf ( 1 ) ;
14131416 } ) ;
@@ -1425,7 +1428,9 @@ describe('CliRepl', function () {
14251428 input . write ( 'exit\n' ) ;
14261429 await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
14271430 const useEvents = requests . flatMap ( ( req ) =>
1428- JSON . parse ( req . body ) . batch . filter ( ( entry ) => entry . event === 'Use' )
1431+ JSON . parse ( req . body ) . batch . filter (
1432+ ( entry : any ) => entry . event === 'Use'
1433+ )
14291434 ) ;
14301435 expect ( useEvents ) . to . have . lengthOf ( 0 ) ;
14311436 } ) ;
@@ -1448,7 +1453,9 @@ describe('CliRepl', function () {
14481453 input . write ( 'exit\n' ) ;
14491454 await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
14501455 const useEvents = requests . flatMap ( ( req ) =>
1451- JSON . parse ( req . body ) . batch . filter ( ( entry ) => entry . event === 'Use' )
1456+ JSON . parse ( req . body ) . batch . filter (
1457+ ( entry : any ) => entry . event === 'Use'
1458+ )
14521459 ) ;
14531460 expect ( useEvents ) . to . have . lengthOf ( 2 ) ;
14541461 } ) ;
@@ -1469,7 +1476,7 @@ describe('CliRepl', function () {
14691476 const loadEvents = requests
14701477 . map ( ( req ) =>
14711478 JSON . parse ( req . body ) . batch . filter (
1472- ( entry ) => entry . event === 'Script Loaded'
1479+ ( entry : any ) => entry . event === 'Script Loaded'
14731480 )
14741481 )
14751482 . flat ( ) ;
@@ -1486,7 +1493,7 @@ describe('CliRepl', function () {
14861493 const apiEvents = requests
14871494 . map ( ( req ) =>
14881495 JSON . parse ( req . body ) . batch . filter (
1489- ( entry ) => entry . event === 'API Call'
1496+ ( entry : any ) => entry . event === 'API Call'
14901497 )
14911498 )
14921499 . flat ( ) ;
@@ -1500,12 +1507,12 @@ describe('CliRepl', function () {
15001507
15011508 it ( 'includes a statement about flushed telemetry in the log' , async function ( ) {
15021509 await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
1503- const { logFilePath } = cliRepl . logWriter ;
1510+ const { logFilePath } = cliRepl . logWriter ! ;
15041511 input . write ( 'db.hello()\n' ) ;
15051512 input . write ( 'exit\n' ) ;
15061513 await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
15071514 const flushEntry = ( await readReplLogfile ( logFilePath ) ) . find (
1508- ( entry ) => entry . id === 1_000_000_045
1515+ ( entry : any ) => entry . id === 1_000_000_045
15091516 ) ;
15101517 expect ( flushEntry . attr . flushError ) . to . equal ( null ) ;
15111518 expect ( flushEntry . attr . flushDuration ) . to . be . a ( 'number' ) ;
@@ -1522,7 +1529,7 @@ describe('CliRepl', function () {
15221529 expect (
15231530 requests
15241531 . flatMap ( ( req ) =>
1525- JSON . parse ( req . body ) . batch . map ( ( entry ) => entry . event )
1532+ JSON . parse ( req . body ) . batch . map ( ( entry : any ) => entry . event )
15261533 )
15271534 . sort ( )
15281535 . filter ( Boolean )
@@ -1550,7 +1557,7 @@ describe('CliRepl', function () {
15501557 const apiEvents = requests
15511558 . map ( ( req ) =>
15521559 JSON . parse ( req . body ) . batch . filter (
1553- ( entry ) => entry . event === 'API Call'
1560+ ( entry : any ) => entry . event === 'API Call'
15541561 )
15551562 )
15561563 . flat ( ) ;
@@ -1712,7 +1719,7 @@ describe('CliRepl', function () {
17121719
17131720 const connectEvents = requests . flatMap ( ( req ) =>
17141721 JSON . parse ( req . body ) . batch . filter (
1715- ( entry ) => entry . event === 'New Connection'
1722+ ( entry : any ) => entry . event === 'New Connection'
17161723 )
17171724 ) ;
17181725 expect ( connectEvents ) . to . have . lengthOf ( 1 ) ;
0 commit comments