Skip to content

Commit 1d2c976

Browse files
authored
chore(smoke-tests): move files into its own package (#6625)
* Add smoke-test package * Move files and fix package * Remove extraneous "undici-type" dep * Update CI to use the new package
1 parent 4f5b48e commit 1d2c976

23 files changed

+259
-31
lines changed

.evergreen/functions.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ functions:
687687
if [[ "$IS_OSX" == "true" ]]; then
688688
echo "Disabling clipboard usage in e2e tests (TODO: https://jira.mongodb.org/browse/BUILD-14780)"
689689
export COMPASS_E2E_DISABLE_CLIPBOARD_USAGE="true"
690-
npm run --unsafe-perm --workspace compass-e2e-tests smoketest -- --package=osx_dmg
690+
npm run --unsafe-perm --workspace @mongodb-js/compass-smoke-tests start -- --package=osx_dmg
691691
# TODO: osx_zip
692692
fi
693693

package-lock.json

Lines changed: 154 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/compass-e2e-tests/.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,3 @@ fixtures/*.csv
44
fixtures/*.json
55
hadron-build-info.json
66

7-
# Ignoring sandboxes (created per test run)
8-
.smoke-sandboxes/
9-
# Cache of downloaded binaries
10-
.smoke-downloads/

packages/compass-e2e-tests/.prettierignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,3 @@ fixtures
44
.nyc_output
55
coverage
66
hadron-build-info.json
7-
8-
# Ignoring sandboxes (created per test run)
9-
.smoke-sandboxes/
10-
# Cache of downloaded binaries
11-
.smoke-downloads/

packages/compass-e2e-tests/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@
7373
"semver": "^7.6.2",
7474
"tree-kill": "^1.2.2",
7575
"ts-node": "^10.9.1",
76-
"undici-types": "^6",
7776
"webdriverio": "^9.4.1",
7877
"why-is-node-running": "^2.3.0",
7978
"xvfb-maybe": "^0.2.1",
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ignores:
2+
- '@mongodb-js/prettier-config-compass'
3+
- '@mongodb-js/tsconfig-compass'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.nyc-output
2+
dist
3+
4+
# Sandboxes (created per test run)
5+
.sandboxes/
6+
# Cache of downloaded files
7+
.downloads/
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
root: true,
3+
extends: ['@mongodb-js/eslint-config-compass'],
4+
parserOptions: {
5+
tsconfigRootDir: __dirname,
6+
project: ['./tsconfig.json'],
7+
},
8+
overrides: [
9+
{
10+
files: ['**/*.ts'],
11+
rules: {
12+
'no-console': 0,
13+
},
14+
},
15+
],
16+
};
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Sandboxes (created per test run)
2+
.sandboxes/
3+
# Cache of downloaded files
4+
.downloads/
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
.nyc_output
2+
dist
3+
coverage
4+
5+
# Sandboxes (created per test run)
6+
.sandboxes/
7+
# Cache of downloaded files
8+
.downloads/
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"@mongodb-js/prettier-config-compass"
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"name": "@mongodb-js/compass-smoke-tests",
3+
"description": "Smoke test suite for Compass app installers",
4+
"author": {
5+
"name": "MongoDB Inc",
6+
"email": "[email protected]"
7+
},
8+
"private": true,
9+
"bugs": {
10+
"url": "https://jira.mongodb.org/projects/COMPASS/issues",
11+
"email": "[email protected]"
12+
},
13+
"homepage": "https://github.com/mongodb-js/compass",
14+
"version": "1.0.0",
15+
"repository": {
16+
"type": "git",
17+
"url": "https://github.com/mongodb-js/compass.git"
18+
},
19+
"compass:exports": {},
20+
"license": "SSPL",
21+
"scripts": {
22+
"start": "ts-node src/cli.ts",
23+
"typecheck": "tsc -p tsconfig.json",
24+
"eslint": "eslint",
25+
"prettier": "prettier",
26+
"lint": "npm run eslint . && npm run prettier -- --check .",
27+
"depcheck": "compass-scripts check-peer-deps && depcheck",
28+
"check": "npm run typecheck && npm run lint && npm run depcheck",
29+
"check-ci": "npm run check",
30+
"reformat": "npm run eslint . -- --fix && npm run prettier -- --write ."
31+
},
32+
"devDependencies": {
33+
"@types/node": "^20",
34+
"@mongodb-js/eslint-config-compass": "^1.2.1",
35+
"@mongodb-js/prettier-config-compass": "^1.1.1",
36+
"@mongodb-js/tsconfig-compass": "^1.1.1",
37+
"depcheck": "^1.4.1",
38+
"eslint": "^7.25.0",
39+
"hadron-build": "^25.6.1",
40+
"lodash": "^4.17.21",
41+
"prettier": "^2.7.1",
42+
"typescript": "^5.0.4",
43+
"yargs": "^17.7.2"
44+
}
45+
}

packages/compass-e2e-tests/helpers/smoke-test/build-info.ts renamed to packages/compass-smoke-tests/src/build-info.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ export function readPackageDetails(
180180
export function writeAndReadPackageDetails(
181181
context: SmokeTestsContext
182182
): PackageDetails {
183-
const compassDir = path.resolve(__dirname, '../../../compass');
183+
const compassDir = path.resolve(__dirname, '../../compass');
184184
const infoArgs = {
185185
format: 'json',
186186
dir: compassDir,

packages/compass-e2e-tests/smoke-test.ts renamed to packages/compass-smoke-tests/src/cli.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,16 @@ import yargs from 'yargs';
77
import { hideBin } from 'yargs/helpers';
88
import { pick } from 'lodash';
99
import { installMacDMG } from './installers/mac-dmg';
10-
import { execute } from './installers/helpers';
10+
import { execute } from './execute';
1111
import {
1212
type PackageDetails,
1313
readPackageDetails,
1414
writeAndReadPackageDetails,
15-
} from './helpers/smoke-test/build-info';
16-
import { createSandbox } from './helpers/smoke-test/directories';
17-
import { downloadFile } from './helpers/smoke-test/downloads';
18-
import {
19-
type PackageKind,
20-
SUPPORTED_PACKAGES,
21-
} from './helpers/smoke-test/packages';
22-
import { type SmokeTestsContext } from './helpers/smoke-test/context';
15+
} from './build-info';
16+
import { createSandbox } from './directories';
17+
import { downloadFile } from './downloads';
18+
import { type PackageKind, SUPPORTED_PACKAGES } from './packages';
19+
import { type SmokeTestsContext } from './context';
2320
import { installMacZIP } from './installers/mac-zip';
2421

2522
const SUPPORTED_PLATFORMS = ['win32', 'darwin', 'linux'] as const;

packages/compass-e2e-tests/helpers/smoke-test/directories.ts renamed to packages/compass-smoke-tests/src/directories.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from 'node:fs';
44
import path from 'node:path';
55

66
function ensureSandboxesDirectory() {
7-
const sandboxesPath = path.resolve(__dirname, '../../.smoke-sandboxes');
7+
const sandboxesPath = path.resolve(__dirname, '../.sandboxes');
88
if (!fs.existsSync(sandboxesPath)) {
99
fs.mkdirSync(sandboxesPath, { recursive: true });
1010
}
@@ -24,7 +24,7 @@ export function createSandbox() {
2424
}
2525

2626
export function ensureDownloadsDirectory() {
27-
const downloadsPath = path.resolve(__dirname, '../../.smoke-downloads');
27+
const downloadsPath = path.resolve(__dirname, '../.downloads');
2828
if (!fs.existsSync(downloadsPath)) {
2929
fs.mkdirSync(downloadsPath, { recursive: true });
3030
}

packages/compass-e2e-tests/helpers/smoke-test/downloads.ts renamed to packages/compass-smoke-tests/src/downloads.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@ import assert from 'node:assert';
22
import fs from 'node:fs';
33
import path from 'node:path';
44
import stream from 'node:stream';
5-
import { type fetch as undiciFetch } from 'undici-types';
6-
7-
// Hacking types here because the DOM types doesn't match the fetch implemented by Node.js
8-
const fetch = globalThis.fetch as unknown as typeof undiciFetch;
95

106
import { ensureDownloadsDirectory } from './directories';
117

packages/compass-e2e-tests/installers/mac-dmg.ts renamed to packages/compass-smoke-tests/src/installers/mac-dmg.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'node:path';
22
import fs from 'node:fs';
33

44
import type { InstalledAppInfo, InstallablePackage } from './types';
5-
import { execute } from './helpers';
5+
import { execute } from '../execute';
66

77
export function installMacDMG({
88
appName,

packages/compass-e2e-tests/installers/mac-zip.ts renamed to packages/compass-smoke-tests/src/installers/mac-zip.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import path from 'node:path';
22
import fs from 'node:fs';
33

44
import type { InstalledAppInfo, InstallablePackage } from './types';
5-
import { execute } from './helpers';
5+
import { execute } from '../execute';
66

77
export function installMacZIP({
88
appName,

0 commit comments

Comments
 (0)