Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/compass-e2e-tests/helpers/compass-web-sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Debug from 'debug';
import {
COMPASS_WEB_SANDBOX_RUNNER_PATH,
COMPASS_WEB_WDIO_USER_DATA_PATH,
ELECTRON_CHROMIUM_VERSION,
MONOREPO_ELECTRON_CHROMIUM_VERSION,
ELECTRON_PATH,
} from './test-runner-paths';
import type { ConnectionInfo } from '@mongodb-js/connection-info';
Expand Down Expand Up @@ -86,7 +86,7 @@ export async function spawnCompassWebSandboxAndSignInToAtlas(
const electronProxyRemote = await remote({
capabilities: {
browserName: 'chromium',
browserVersion: ELECTRON_CHROMIUM_VERSION,
browserVersion: MONOREPO_ELECTRON_CHROMIUM_VERSION,
'goog:chromeOptions': {
binary: ELECTRON_PATH,
args: [
Expand Down
11 changes: 9 additions & 2 deletions packages/compass-e2e-tests/helpers/compass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import {
isTestingAtlasCloudExternal,
} from './test-runner-context';
import {
ELECTRON_CHROMIUM_VERSION,
MONOREPO_ELECTRON_CHROMIUM_VERSION,
LOG_PATH,
LOG_COVERAGE_PATH,
COMPASS_DESKTOP_PATH,
Expand Down Expand Up @@ -473,6 +473,11 @@ function execFileIgnoreError(
});
}

async function getChromiumVersionFromBinary(path: string) {
const { stdout } = await execFileIgnoreError(path, ['--versions'], {});
Comment on lines +476 to +477
Copy link

Copilot AI Jul 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The parameter name path shadows the imported path module; consider renaming it (e.g., to binaryPath) to avoid confusion.

Suggested change
async function getChromiumVersionFromBinary(path: string) {
const { stdout } = await execFileIgnoreError(path, ['--versions'], {});
async function getChromiumVersionFromBinary(binaryPath: string) {
const { stdout } = await execFileIgnoreError(binaryPath, ['--versions'], {});

Copilot uses AI. Check for mistakes.
return JSON.parse(stdout).chrome;
}

export async function runCompassOnce(args: string[], timeout = 30_000) {
const { binary } = await getCompassExecutionParameters();
debug('spawning compass...', {
Expand Down Expand Up @@ -654,7 +659,9 @@ async function startCompassElectron(
automationProtocol: 'webdriver' as const,
capabilities: {
browserName: 'chromium',
browserVersion: ELECTRON_CHROMIUM_VERSION,
browserVersion: testPackagedApp
? await getChromiumVersionFromBinary(binary)
: MONOREPO_ELECTRON_CHROMIUM_VERSION,
// https://chromedriver.chromium.org/capabilities#h.p_ID_106
'goog:chromeOptions': {
binary: maybeWrappedBinary,
Expand Down
6 changes: 4 additions & 2 deletions packages/compass-e2e-tests/helpers/test-runner-paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ export const LOG_COVERAGE_PATH = path.join(LOG_PATH, 'coverage');
export const COVERAGE_PATH = (process.env.COVERAGE = MONOREPO_ROOT_PATH);

export const ELECTRON_PATH = electronPath;
export const ELECTRON_VERSION = electronPackageJson.version;
export const ELECTRON_CHROMIUM_VERSION = electronToChromium(ELECTRON_VERSION);
export const MONOREPO_ELECTRON_VERSION = electronPackageJson.version;
export const MONOREPO_ELECTRON_CHROMIUM_VERSION = electronToChromium(
MONOREPO_ELECTRON_VERSION
);

export const COMPASS_WEB_SANDBOX_RUNNER_PATH = path.resolve(
path.dirname(require.resolve('@mongodb-js/compass-web/package.json')),
Expand Down
11 changes: 11 additions & 0 deletions packages/compass-preferences-model/src/preferences-schema.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export type CliOnlyPreferences = {
importConnections?: string;
passphrase?: string;
version?: boolean;
versions?: boolean;
help?: boolean;
showExampleConfig?: boolean;
trustedConnectionString?: boolean;
Expand Down Expand Up @@ -1070,6 +1071,16 @@ const cliOnlyPreferencesProps: Required<{
validator: z.boolean().optional(),
type: 'boolean',
},
versions: {
ui: false,
cli: true,
global: false,
description: {
short: 'Show Node, Electron, Chromium Versions',
},
validator: z.boolean().optional(),
type: 'boolean',
},
showExampleConfig: {
ui: false,
cli: true,
Expand Down
4 changes: 4 additions & 0 deletions packages/compass/src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ async function main(): Promise<void> {
process.stdout.write(`${app.getName()} ${app.getVersion()}\n`);
return app.exit(0);
}
if (preferences.versions) {
process.stdout.write(`${JSON.stringify(process.versions)}\n`);
return app.exit(0);
}

if (preferences.help) {
process.stdout.write(getHelpText());
Expand Down
Loading