Skip to content

Commit bb111a5

Browse files
committed
fix tests and match with mongosh --version
1 parent 9c4c358 commit bb111a5

File tree

3 files changed

+21
-10
lines changed

3 files changed

+21
-10
lines changed

packages/build/src/npm-packages/publish.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,14 @@ describe('npm-packages publishNpmPackages', function () {
7171
spawnSync
7272
);
7373

74-
expect(spawnSync).calledWith('git', ['tag', '-a', '1.2.0', '-m', '1.2.0']);
75-
expect(spawnSync).calledWith('git', ['push', '--follow-tags']);
74+
expect(spawnSync).not.calledWith('git', [
75+
'tag',
76+
'-a',
77+
'1.2.0',
78+
'-m',
79+
'1.2.0',
80+
]);
81+
expect(spawnSync).not.calledWith('git', ['push', '--follow-tags']);
7682
});
7783

7884
it('calls lerna to publish packages for a real version', function () {

packages/e2e-tests/test/e2e.spec.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import { once } from 'events';
2222
import type { AddressInfo } from 'net';
2323
const { EJSON } = bson;
2424
import { sleep } from './util-helpers';
25-
import { MONGOSH_VERSION } from '../../cli-repl/src/constants';
2625

2726
const 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 () {

packages/shell-api/src/mongosh-version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* NOTE: Do not manually modify this file.
3-
* The MONGOSH_VERSION gets re-generated automatically with scripts/set-mongosh-version.ts
3+
* The MONGOSH_VERSION gets generated automatically during mongosh releases.
44
**/
55

66
/** Current mongosh cli-repl version. */

0 commit comments

Comments
 (0)