@@ -22,7 +22,7 @@ import { once } from 'events';
2222import type { AddressInfo } from 'net' ;
2323const { EJSON } = bson ;
2424import { sleep } from './util-helpers' ;
25- import type { LogEntry } from '@mongosh/shell-api/src/ log-entry ' ;
25+ import type { MongoLogEntry } from 'mongodb- log-writer ' ;
2626
2727const jsContextFlagCombinations : `--jsContext=${'plain-vm' | 'repl' } `[ ] [ ] = [
2828 [ ] ,
@@ -1356,7 +1356,7 @@ describe('e2e', function () {
13561356 let logBasePath : string ;
13571357 let historyPath : string ;
13581358 let readConfig : ( ) => Promise < any > ;
1359- let readLogFile : < T = LogEntry > ( ) => Promise < T [ ] > ;
1359+ let readLogFile : < T extends MongoLogEntry > ( ) => Promise < T [ ] > ;
13601360 let startTestShell : ( ...extraArgs : string [ ] ) => Promise < TestShell > ;
13611361
13621362 beforeEach ( function ( ) {
@@ -1393,12 +1393,12 @@ describe('e2e', function () {
13931393 }
13941394 readConfig = async ( ) =>
13951395 EJSON . parse ( await fs . readFile ( configPath , 'utf8' ) ) ;
1396- readLogFile = async ( ) => {
1396+ readLogFile = async < T extends MongoLogEntry > ( ) : Promise < T [ ] > => {
13971397 if ( ! shell . logId ) {
13981398 throw new Error ( 'Shell does not have a logId associated with it' ) ;
13991399 }
14001400 const logPath = path . join ( logBasePath , `${ shell . logId } _log` ) ;
1401- return readReplLogfile ( logPath ) ;
1401+ return readReplLogfile < T > ( logPath ) ;
14021402 } ;
14031403 startTestShell = async ( ...extraArgs : string [ ] ) => {
14041404 const shell = this . startTestShell ( {
@@ -1551,7 +1551,6 @@ describe('e2e', function () {
15511551
15521552 const log = await readLogFile ( ) ;
15531553 expect (
1554- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
15551554 log . filter (
15561555 ( logEntry ) => logEntry . attr ?. input === 'print(123 + 456)'
15571556 )
@@ -1562,7 +1561,6 @@ describe('e2e', function () {
15621561 expect ( await shell . executeLine ( 'print(123 + 456)' ) ) . to . include ( '579' ) ;
15631562 const log = await readLogFile ( ) ;
15641563 expect (
1565- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
15661564 log . filter (
15671565 ( logEntry ) => logEntry . attr ?. input === 'print(123 + 456)'
15681566 )
@@ -1595,12 +1593,12 @@ describe('e2e', function () {
15951593 } ) ;
15961594
15971595 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 ' ) ;
15991597
16001598 let log = await readLogFile ( ) ;
16011599 expect (
16021600 log . filter (
1603- ( logEntry ) => logEntry . attr ?. input === 'print(222 - 111 )'
1601+ ( logEntry ) => logEntry . attr ?. input === 'print(111 + 222 )'
16041602 )
16051603 ) . to . have . lengthOf ( 1 ) ;
16061604
@@ -1632,7 +1630,7 @@ describe('e2e', function () {
16321630
16331631 expect (
16341632 log . filter (
1635- ( logEntry ) => logEntry . attr ?. input === 'print(222 - 111 )'
1633+ ( logEntry ) => logEntry . attr ?. input === 'print(111 + 222 )'
16361634 )
16371635 ) . to . have . lengthOf ( 1 ) ;
16381636 expect (
@@ -1668,12 +1666,12 @@ describe('e2e', function () {
16681666 await shell . executeLine ( "log.info('This is a custom entry')" ) ;
16691667 expect ( shell . assertNoErrors ( ) ) ;
16701668 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+ > ( ) ;
16771675 const customLogEntry = log . filter ( ( logEntry ) =>
16781676 logEntry . msg . includes ( 'This is a custom entry' )
16791677 ) ;
@@ -1697,7 +1695,7 @@ describe('e2e', function () {
16971695 await shell . executeLine ( `load(${ JSON . stringify ( filename ) } )` ) ;
16981696 expect ( shell . assertNoErrors ( ) ) ;
16991697 await eventually ( async ( ) => {
1700- const log = await readLogFile < { msg : string } > ( ) ;
1698+ const log = await readLogFile ( ) ;
17011699 expect (
17021700 log . filter ( ( logEntry ) =>
17031701 logEntry . msg . includes ( 'Initiating connection attemp' )
0 commit comments