@@ -22,7 +22,7 @@ import { once } from 'events';
22
22
import type { AddressInfo } from 'net' ;
23
23
const { EJSON } = bson ;
24
24
import { sleep } from './util-helpers' ;
25
- import type { LogEntry } from '@mongosh/shell-api/src/ log-entry ' ;
25
+ import type { MongoLogEntry } from 'mongodb- log-writer ' ;
26
26
27
27
const jsContextFlagCombinations : `--jsContext=${'plain-vm' | 'repl' } `[ ] [ ] = [
28
28
[ ] ,
@@ -1356,7 +1356,7 @@ describe('e2e', function () {
1356
1356
let logBasePath : string ;
1357
1357
let historyPath : string ;
1358
1358
let readConfig : ( ) => Promise < any > ;
1359
- let readLogFile : < T = LogEntry > ( ) => Promise < T [ ] > ;
1359
+ let readLogFile : < T extends MongoLogEntry > ( ) => Promise < T [ ] > ;
1360
1360
let startTestShell : ( ...extraArgs : string [ ] ) => Promise < TestShell > ;
1361
1361
1362
1362
beforeEach ( function ( ) {
@@ -1393,12 +1393,12 @@ describe('e2e', function () {
1393
1393
}
1394
1394
readConfig = async ( ) =>
1395
1395
EJSON . parse ( await fs . readFile ( configPath , 'utf8' ) ) ;
1396
- readLogFile = async ( ) => {
1396
+ readLogFile = async < T extends MongoLogEntry > ( ) : Promise < T [ ] > => {
1397
1397
if ( ! shell . logId ) {
1398
1398
throw new Error ( 'Shell does not have a logId associated with it' ) ;
1399
1399
}
1400
1400
const logPath = path . join ( logBasePath , `${ shell . logId } _log` ) ;
1401
- return readReplLogfile ( logPath ) ;
1401
+ return readReplLogfile < T > ( logPath ) ;
1402
1402
} ;
1403
1403
startTestShell = async ( ...extraArgs : string [ ] ) => {
1404
1404
const shell = this . startTestShell ( {
@@ -1551,7 +1551,6 @@ describe('e2e', function () {
1551
1551
1552
1552
const log = await readLogFile ( ) ;
1553
1553
expect (
1554
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
1555
1554
log . filter (
1556
1555
( logEntry ) => logEntry . attr ?. input === 'print(123 + 456)'
1557
1556
)
@@ -1562,7 +1561,6 @@ describe('e2e', function () {
1562
1561
expect ( await shell . executeLine ( 'print(123 + 456)' ) ) . to . include ( '579' ) ;
1563
1562
const log = await readLogFile ( ) ;
1564
1563
expect (
1565
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
1566
1564
log . filter (
1567
1565
( logEntry ) => logEntry . attr ?. input === 'print(123 + 456)'
1568
1566
)
@@ -1595,12 +1593,12 @@ describe('e2e', function () {
1595
1593
} ) ;
1596
1594
1597
1595
it ( 'starts writing to the same log from the point where disableLogging is set to false' , async function ( ) {
1598
- expect ( await shell . executeLine ( 'print(222 - 111 )' ) ) . to . include ( '111 ' ) ;
1596
+ expect ( await shell . executeLine ( 'print(111 + 222 )' ) ) . to . include ( '333 ' ) ;
1599
1597
1600
1598
let log = await readLogFile ( ) ;
1601
1599
expect (
1602
1600
log . filter (
1603
- ( logEntry ) => logEntry . attr ?. input === 'print(222 - 111 )'
1601
+ ( logEntry ) => logEntry . attr ?. input === 'print(111 + 222 )'
1604
1602
)
1605
1603
) . to . have . lengthOf ( 1 ) ;
1606
1604
@@ -1632,7 +1630,7 @@ describe('e2e', function () {
1632
1630
1633
1631
expect (
1634
1632
log . filter (
1635
- ( logEntry ) => logEntry . attr ?. input === 'print(222 - 111 )'
1633
+ ( logEntry ) => logEntry . attr ?. input === 'print(111 + 222 )'
1636
1634
)
1637
1635
) . to . have . lengthOf ( 1 ) ;
1638
1636
expect (
@@ -1668,12 +1666,12 @@ describe('e2e', function () {
1668
1666
await shell . executeLine ( "log.info('This is a custom entry')" ) ;
1669
1667
expect ( shell . assertNoErrors ( ) ) ;
1670
1668
await eventually ( async ( ) => {
1671
- const log = await readLogFile < {
1672
- msg : string ;
1673
- s : string ;
1674
- c : string ;
1675
- ctx : string ;
1676
- } > ( ) ;
1669
+ const log = await readLogFile <
1670
+ MongoLogEntry & {
1671
+ c : string ;
1672
+ ctx : string ;
1673
+ }
1674
+ > ( ) ;
1677
1675
const customLogEntry = log . filter ( ( logEntry ) =>
1678
1676
logEntry . msg . includes ( 'This is a custom entry' )
1679
1677
) ;
@@ -1697,7 +1695,7 @@ describe('e2e', function () {
1697
1695
await shell . executeLine ( `load(${ JSON . stringify ( filename ) } )` ) ;
1698
1696
expect ( shell . assertNoErrors ( ) ) ;
1699
1697
await eventually ( async ( ) => {
1700
- const log = await readLogFile < { msg : string } > ( ) ;
1698
+ const log = await readLogFile ( ) ;
1701
1699
expect (
1702
1700
log . filter ( ( logEntry ) =>
1703
1701
logEntry . msg . includes ( 'Initiating connection attemp' )
0 commit comments