@@ -22,7 +22,6 @@ 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 { MONGOSH_VERSION } from '../../cli-repl/src/constants' ;
26
25
27
26
const jsContextFlagCombinations : `--jsContext=${'plain-vm' | 'repl' } `[ ] [ ] = [
28
27
[ ] ,
@@ -34,11 +33,15 @@ describe('e2e', function () {
34
33
const testServer = startSharedTestServer ( ) ;
35
34
36
35
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
+
38
41
const shell = this . startTestShell ( { args : [ '--version' ] } ) ;
39
42
await shell . waitForSuccessfulExit ( ) ;
40
43
41
- shell . assertContainsOutput ( require ( '../package.json' ) . version ) ;
44
+ shell . assertContainsOutput ( expectedPackageVersion ) ;
42
45
} ) ;
43
46
} ) ;
44
47
@@ -449,16 +452,18 @@ describe('e2e', function () {
449
452
const expectedPackageVersion : string =
450
453
// eslint-disable-next-line @typescript-eslint/no-var-requires
451
454
require ( '../package.json' ) [ 'dependencies' ] [ '@mongosh/cli-repl' ] ;
452
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
453
- const expectedVersionFromRepl = MONGOSH_VERSION ;
454
455
455
456
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 ;
457
462
458
463
await shell . executeLine ( 'version()' ) ;
459
464
shell . assertNoErrors ( ) ;
460
465
shell . assertContainsOutput ( expectedPackageVersion ) ;
461
- shell . assertContainsOutput ( expectedVersionFromRepl ) ;
466
+ shell . assertContainsOutput ( versionFromShell ) ;
462
467
} ) ;
463
468
464
469
it ( 'fle addon is available' , async function ( ) {
0 commit comments