Skip to content

Commit 8129314

Browse files
committed
Derive a target specific app name
1 parent 0f73014 commit 8129314

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

packages/compass-smoke-tests/src/build-info.ts

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,27 +41,65 @@ export const windowsFilenameKeys = [
4141
'windows_nupkg_full_filename',
4242
] as const;
4343
export type WindowsBuildInfo = CommonBuildInfo &
44-
Record<typeof windowsFilenameKeys[number], string>;
44+
Record<typeof windowsFilenameKeys[number], string> & {
45+
installerOptions: {
46+
name: string;
47+
};
48+
};
4549

4650
export function assertBuildInfoIsWindows(
4751
buildInfo: unknown
4852
): asserts buildInfo is WindowsBuildInfo {
4953
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
5054
assertObjectHasKeys(buildInfo, 'buildInfo', windowsFilenameKeys);
55+
assert(typeof buildInfo === 'object', 'Expected buildInfo to be an object');
56+
assert(buildInfo !== null, 'Expected buildInfo to be an object');
57+
assert(
58+
'installerOptions' in buildInfo &&
59+
typeof buildInfo.installerOptions === 'object',
60+
'Expected buildInfo.installerOptions to be an object'
61+
);
62+
const { installerOptions } = buildInfo;
63+
assert(
64+
typeof installerOptions === 'object' &&
65+
installerOptions !== null &&
66+
'name' in installerOptions &&
67+
typeof installerOptions.name === 'string',
68+
'Expected buildInfo.installerOptions.name to be a string'
69+
);
5170
}
5271

5372
export const osxFilenameKeys = [
5473
'osx_dmg_filename',
5574
'osx_zip_filename',
5675
] as const;
5776
export type OSXBuildInfo = CommonBuildInfo &
58-
Record<typeof osxFilenameKeys[number], string>;
77+
Record<typeof osxFilenameKeys[number], string> & {
78+
installerOptions: {
79+
title: string;
80+
};
81+
};
5982

6083
export function assertBuildInfoIsOSX(
6184
buildInfo: unknown
6285
): asserts buildInfo is OSXBuildInfo {
6386
assertObjectHasKeys(buildInfo, 'buildInfo', commonKeys);
6487
assertObjectHasKeys(buildInfo, 'buildInfo', osxFilenameKeys);
88+
assert(typeof buildInfo === 'object', 'Expected buildInfo to be an object');
89+
assert(buildInfo !== null, 'Expected buildInfo to be an object');
90+
assert(
91+
'installerOptions' in buildInfo &&
92+
typeof buildInfo.installerOptions === 'object',
93+
'Expected buildInfo.installerOptions to be an object'
94+
);
95+
const { installerOptions } = buildInfo;
96+
assert(
97+
typeof installerOptions === 'object' &&
98+
installerOptions !== null &&
99+
'title' in installerOptions &&
100+
typeof installerOptions.title === 'string',
101+
'Expected buildInfo.installerOptions.title to be a string'
102+
);
65103
}
66104

67105
export const ubuntuFilenameKeys = [
@@ -93,6 +131,7 @@ export type PackageDetails = {
93131
kind: PackageKind;
94132
filename: string;
95133
autoUpdatable: boolean;
134+
appName: string;
96135
} & (
97136
| {
98137
kind: 'windows_setup' | 'windows_msi' | 'windows_zip';
@@ -129,6 +168,7 @@ export function getPackageDetails(
129168
kind,
130169
buildInfo,
131170
filename: buildInfo[`${kind}_filename`],
171+
appName: buildInfo.installerOptions.name,
132172
autoUpdatable: kind === 'windows_setup',
133173
};
134174
} else if (kind === 'osx_dmg' || kind === 'osx_zip') {
@@ -137,6 +177,7 @@ export function getPackageDetails(
137177
kind,
138178
buildInfo,
139179
filename: buildInfo[`${kind}_filename`],
180+
appName: buildInfo.installerOptions.title,
140181
autoUpdatable: true,
141182
};
142183
} else if (kind === 'linux_deb' || kind === 'linux_tar') {
@@ -145,6 +186,7 @@ export function getPackageDetails(
145186
kind,
146187
buildInfo,
147188
filename: buildInfo[`${kind}_filename`],
189+
appName: buildInfo.productName,
148190
autoUpdatable: false,
149191
};
150192
} else if (kind === 'linux_rpm' || kind === 'rhel_tar') {
@@ -153,6 +195,7 @@ export function getPackageDetails(
153195
kind,
154196
buildInfo,
155197
filename: buildInfo[`${kind}_filename`],
198+
appName: buildInfo.productName,
156199
autoUpdatable: false,
157200
};
158201
} else {

packages/compass-smoke-tests/src/cli.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,10 @@ async function run() {
175175
])
176176
);
177177

178-
const { kind, buildInfo, filepath } = await getTestSubject(context);
178+
const { kind, filepath, appName } = await getTestSubject(context);
179179
const install = getInstaller(kind);
180180

181181
try {
182-
const appName = buildInfo.productName;
183-
184182
const { appPath, uninstall } = install({
185183
appName,
186184
filepath,
@@ -194,7 +192,7 @@ async function run() {
194192
}
195193
} finally {
196194
console.log('Cleaning up sandbox');
197-
fs.rmSync(context.sandboxPath, { recursive: true });
195+
// fs.rmSync(context.sandboxPath, { recursive: true });
198196
}
199197
}
200198

0 commit comments

Comments
 (0)