@@ -22,7 +22,6 @@ import { once } from 'events';
2222import type { AddressInfo } from 'net' ;
2323const { EJSON } = bson ;
2424import { sleep } from './util-helpers' ;
25- import { MONGOSH_VERSION } from '../../cli-repl/src/constants' ;
2625
2726const jsContextFlagCombinations : `--jsContext=${'plain-vm' | 'repl' } `[ ] [ ] = [
2827 [ ] ,
@@ -34,11 +33,15 @@ describe('e2e', function () {
3433 const testServer = startSharedTestServer ( ) ;
3534
3635 describe ( '--version' , function ( ) {
37- it ( 'shows version' , async function ( ) {
36+ it ( 'shows version which matches @mongosh/cli-repl' , async function ( ) {
37+ const expectedPackageVersion : string =
38+ // eslint-disable-next-line @typescript-eslint/no-var-requires
39+ require ( '../package.json' ) [ 'dependencies' ] [ '@mongosh/cli-repl' ] ;
40+
3841 const shell = this . startTestShell ( { args : [ '--version' ] } ) ;
3942 await shell . waitForSuccessfulExit ( ) ;
4043
41- shell . assertContainsOutput ( require ( '../package.json' ) . version ) ;
44+ shell . assertContainsOutput ( expectedPackageVersion ) ;
4245 } ) ;
4346 } ) ;
4447
@@ -449,16 +452,18 @@ describe('e2e', function () {
449452 const expectedPackageVersion : string =
450453 // eslint-disable-next-line @typescript-eslint/no-var-requires
451454 require ( '../package.json' ) [ 'dependencies' ] [ '@mongosh/cli-repl' ] ;
452- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
453- const expectedVersionFromRepl = MONGOSH_VERSION ;
454455
455456 expect ( expectedPackageVersion ) . not . null ;
456- expect ( expectedPackageVersion ) . equals ( expectedVersionFromRepl ) ;
457+
458+ const versionShell = this . startTestShell ( { args : [ '--version' ] } ) ;
459+ await versionShell . waitForSuccessfulExit ( ) ;
460+
461+ const versionFromShell = versionShell . output ;
457462
458463 await shell . executeLine ( 'version()' ) ;
459464 shell . assertNoErrors ( ) ;
460465 shell . assertContainsOutput ( expectedPackageVersion ) ;
461- shell . assertContainsOutput ( expectedVersionFromRepl ) ;
466+ shell . assertContainsOutput ( versionFromShell ) ;
462467 } ) ;
463468
464469 it ( 'fle addon is available' , async function ( ) {
0 commit comments