@@ -51,6 +51,7 @@ describe('CliRepl', function () {
51
51
const tmpdir = useTmpdir ( ) ;
52
52
53
53
async function log ( ) : Promise < any [ ] > {
54
+ if ( ! cliRepl . logWriter ?. logFilePath ) return [ ] ;
54
55
await cliRepl . logWriter . flush ( ) ; // Ensure any pending data is written first
55
56
return readReplLogfile ( cliRepl . logWriter . logFilePath ) ;
56
57
}
@@ -76,8 +77,8 @@ describe('CliRepl', function () {
76
77
} ) ;
77
78
exitCode = null ;
78
79
79
- let resolveExitPromise ;
80
- exitPromise = new Promise ( ( resolve ) => {
80
+ let resolveExitPromise ! : ( ) => void ;
81
+ exitPromise = new Promise < void > ( ( resolve ) => {
81
82
resolveExitPromise = resolve ;
82
83
} ) ;
83
84
@@ -858,7 +859,7 @@ describe('CliRepl', function () {
858
859
try {
859
860
await cliRepl . start ( '' , { } ) ;
860
861
expect . fail ( 'missed exception' ) ;
861
- } catch ( err ) {
862
+ } catch ( err : any ) {
862
863
expect ( err . message ) . to . equal ( 'nested error' ) ;
863
864
}
864
865
} ) ;
@@ -869,7 +870,7 @@ describe('CliRepl', function () {
869
870
try {
870
871
await cliRepl . start ( '' , { } ) ;
871
872
expect . fail ( 'missed exception' ) ;
872
- } catch ( err ) {
873
+ } catch ( err : any ) {
873
874
expect ( err . message ) . to . equal (
874
875
'Cannot use --json without --eval or with --shell or with extra files'
875
876
) ;
@@ -884,7 +885,7 @@ describe('CliRepl', function () {
884
885
try {
885
886
await cliRepl . start ( '' , { } ) ;
886
887
expect . fail ( 'missed exception' ) ;
887
- } catch ( err ) {
888
+ } catch ( err : any ) {
888
889
expect ( err . message ) . to . equal (
889
890
'Cannot use --json without --eval or with --shell or with extra files'
890
891
) ;
@@ -899,7 +900,7 @@ describe('CliRepl', function () {
899
900
try {
900
901
await cliRepl . start ( '' , { } ) ;
901
902
expect . fail ( 'missed exception' ) ;
902
- } catch ( err ) {
903
+ } catch ( err : any ) {
903
904
expect ( err . message ) . to . equal (
904
905
'Cannot use --json without --eval or with --shell or with extra files'
905
906
) ;
@@ -1285,7 +1286,7 @@ describe('CliRepl', function () {
1285
1286
it ( 'does not emit warnings when connecting multiple times' , async function ( ) {
1286
1287
await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
1287
1288
let warnings = 0 ;
1288
- const warningListener = ( warning ) => {
1289
+ const warningListener = ( warning : unknown ) => {
1289
1290
console . log ( 'Unexpected warning' , warning ) ;
1290
1291
warnings ++ ;
1291
1292
} ;
@@ -1407,7 +1408,9 @@ describe('CliRepl', function () {
1407
1408
input . write ( 'exit\n' ) ;
1408
1409
await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
1409
1410
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
+ )
1411
1414
) ;
1412
1415
expect ( useEvents ) . to . have . lengthOf ( 1 ) ;
1413
1416
} ) ;
@@ -1425,7 +1428,9 @@ describe('CliRepl', function () {
1425
1428
input . write ( 'exit\n' ) ;
1426
1429
await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
1427
1430
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
+ )
1429
1434
) ;
1430
1435
expect ( useEvents ) . to . have . lengthOf ( 0 ) ;
1431
1436
} ) ;
@@ -1448,7 +1453,9 @@ describe('CliRepl', function () {
1448
1453
input . write ( 'exit\n' ) ;
1449
1454
await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
1450
1455
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
+ )
1452
1459
) ;
1453
1460
expect ( useEvents ) . to . have . lengthOf ( 2 ) ;
1454
1461
} ) ;
@@ -1469,7 +1476,7 @@ describe('CliRepl', function () {
1469
1476
const loadEvents = requests
1470
1477
. map ( ( req ) =>
1471
1478
JSON . parse ( req . body ) . batch . filter (
1472
- ( entry ) => entry . event === 'Script Loaded'
1479
+ ( entry : any ) => entry . event === 'Script Loaded'
1473
1480
)
1474
1481
)
1475
1482
. flat ( ) ;
@@ -1486,7 +1493,7 @@ describe('CliRepl', function () {
1486
1493
const apiEvents = requests
1487
1494
. map ( ( req ) =>
1488
1495
JSON . parse ( req . body ) . batch . filter (
1489
- ( entry ) => entry . event === 'API Call'
1496
+ ( entry : any ) => entry . event === 'API Call'
1490
1497
)
1491
1498
)
1492
1499
. flat ( ) ;
@@ -1500,12 +1507,12 @@ describe('CliRepl', function () {
1500
1507
1501
1508
it ( 'includes a statement about flushed telemetry in the log' , async function ( ) {
1502
1509
await cliRepl . start ( await testServer . connectionString ( ) , { } ) ;
1503
- const { logFilePath } = cliRepl . logWriter ;
1510
+ const { logFilePath } = cliRepl . logWriter ! ;
1504
1511
input . write ( 'db.hello()\n' ) ;
1505
1512
input . write ( 'exit\n' ) ;
1506
1513
await waitBus ( cliRepl . bus , 'mongosh:closed' ) ;
1507
1514
const flushEntry = ( await readReplLogfile ( logFilePath ) ) . find (
1508
- ( entry ) => entry . id === 1_000_000_045
1515
+ ( entry : any ) => entry . id === 1_000_000_045
1509
1516
) ;
1510
1517
expect ( flushEntry . attr . flushError ) . to . equal ( null ) ;
1511
1518
expect ( flushEntry . attr . flushDuration ) . to . be . a ( 'number' ) ;
@@ -1522,7 +1529,7 @@ describe('CliRepl', function () {
1522
1529
expect (
1523
1530
requests
1524
1531
. flatMap ( ( req ) =>
1525
- JSON . parse ( req . body ) . batch . map ( ( entry ) => entry . event )
1532
+ JSON . parse ( req . body ) . batch . map ( ( entry : any ) => entry . event )
1526
1533
)
1527
1534
. sort ( )
1528
1535
. filter ( Boolean )
@@ -1550,7 +1557,7 @@ describe('CliRepl', function () {
1550
1557
const apiEvents = requests
1551
1558
. map ( ( req ) =>
1552
1559
JSON . parse ( req . body ) . batch . filter (
1553
- ( entry ) => entry . event === 'API Call'
1560
+ ( entry : any ) => entry . event === 'API Call'
1554
1561
)
1555
1562
)
1556
1563
. flat ( ) ;
@@ -1712,7 +1719,7 @@ describe('CliRepl', function () {
1712
1719
1713
1720
const connectEvents = requests . flatMap ( ( req ) =>
1714
1721
JSON . parse ( req . body ) . batch . filter (
1715
- ( entry ) => entry . event === 'New Connection'
1722
+ ( entry : any ) => entry . event === 'New Connection'
1716
1723
)
1717
1724
) ;
1718
1725
expect ( connectEvents ) . to . have . lengthOf ( 1 ) ;
0 commit comments