@devicecloud.dev/dcd 5.2.0-beta.2 → 5.2.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/commands/cloud.js
CHANGED
|
@@ -16,7 +16,7 @@ import { TestSubmissionService } from '../services/test-submission.service.js';
|
|
|
16
16
|
import { VersionService } from '../services/version.service.js';
|
|
17
17
|
import { EAndroidApiLevels, EAndroidDevices, EiOSDevices, EiOSVersions, isIosMatrixConfig, } from '../types/domain/device.types.js';
|
|
18
18
|
import { resolveAuth } from '../utils/auth.js';
|
|
19
|
-
import { matrixIsIos, parseDeviceMatrix } from '../utils/device-matrix.js';
|
|
19
|
+
import { assertMatrixSupported, matrixIsIos, parseDeviceMatrix, } from '../utils/device-matrix.js';
|
|
20
20
|
import { detectCiContext, isCI } from '../utils/ci.js';
|
|
21
21
|
import { CliError, coerceArray, collectRepeatedFlag, getCliVersion, getUpgradeCommand, logger, parseIntFlag, validateEnum, } from '../utils/cli.js';
|
|
22
22
|
import { fetchCompatibilityData, } from '../utils/compatibility.js';
|
|
@@ -560,6 +560,10 @@ export const cloudCommand = defineCommand({
|
|
|
560
560
|
// there is no matrix, and tolerant of older APIs that lack the endpoint.
|
|
561
561
|
if (deviceMatrix.length > 0) {
|
|
562
562
|
const estimate = await ApiGateway.estimateMatrix(apiUrl, auth, fields);
|
|
563
|
+
// A null estimate means the API predates the matrix (404/405). It would
|
|
564
|
+
// silently strip deviceMatrix and run one device — refuse rather than
|
|
565
|
+
// hand back a green single-device run the user reads as a matrix.
|
|
566
|
+
assertMatrixSupported(deviceMatrix, estimate);
|
|
563
567
|
if (estimate) {
|
|
564
568
|
const osPrefix = matrixIsIos(deviceMatrix) ? 'iOS' : 'API';
|
|
565
569
|
const rows = ui.fields([
|
|
@@ -1,4 +1,18 @@
|
|
|
1
1
|
import { DeviceMatrixConfig } from '../types/domain/device.types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Refuse to submit a device matrix to an API that cannot honour it.
|
|
4
|
+
*
|
|
5
|
+
* The estimate endpoint is only called when a matrix was actually requested, so
|
|
6
|
+
* a null estimate (the gateway maps 404/405 to null) means the API predates the
|
|
7
|
+
* feature. That API would **silently strip** the unknown `deviceMatrix` field —
|
|
8
|
+
* its ValidationPipe runs `whitelist: true, forbidNonWhitelisted: false` — and
|
|
9
|
+
* run every flow on a single default device, exiting 0. The user would believe
|
|
10
|
+
* they had tested N devices when they tested one: the exact silent
|
|
11
|
+
* under-testing the device matrix exists to prevent. Fail loudly instead.
|
|
12
|
+
*
|
|
13
|
+
* @throws CliError when a matrix was requested but the API does not support it.
|
|
14
|
+
*/
|
|
15
|
+
export declare function assertMatrixSupported(deviceMatrix: DeviceMatrixConfig[], estimate: unknown | null): void;
|
|
2
16
|
/**
|
|
3
17
|
* Parse repeated `--ios-device-matrix <device>:<version>` and
|
|
4
18
|
* `--android-device-matrix <device>:<apiLevel>[:play]` flags into an explicit device
|
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
import { isIosMatrixConfig, } from '../types/domain/device.types.js';
|
|
2
2
|
import { CliError } from './cli.js';
|
|
3
|
+
/**
|
|
4
|
+
* Refuse to submit a device matrix to an API that cannot honour it.
|
|
5
|
+
*
|
|
6
|
+
* The estimate endpoint is only called when a matrix was actually requested, so
|
|
7
|
+
* a null estimate (the gateway maps 404/405 to null) means the API predates the
|
|
8
|
+
* feature. That API would **silently strip** the unknown `deviceMatrix` field —
|
|
9
|
+
* its ValidationPipe runs `whitelist: true, forbidNonWhitelisted: false` — and
|
|
10
|
+
* run every flow on a single default device, exiting 0. The user would believe
|
|
11
|
+
* they had tested N devices when they tested one: the exact silent
|
|
12
|
+
* under-testing the device matrix exists to prevent. Fail loudly instead.
|
|
13
|
+
*
|
|
14
|
+
* @throws CliError when a matrix was requested but the API does not support it.
|
|
15
|
+
*/
|
|
16
|
+
export function assertMatrixSupported(deviceMatrix, estimate) {
|
|
17
|
+
if (deviceMatrix.length === 0 || estimate)
|
|
18
|
+
return;
|
|
19
|
+
throw new CliError('This DeviceCloud API does not support device matrices, so ' +
|
|
20
|
+
'--ios-device-matrix / --android-device-matrix cannot be honoured. ' +
|
|
21
|
+
'Submitting anyway would silently run every flow on a single default ' +
|
|
22
|
+
'device and report success. Upgrade the API, or drop the matrix flags ' +
|
|
23
|
+
'and use --ios-device / --android-device for a single-device run.');
|
|
24
|
+
}
|
|
3
25
|
/**
|
|
4
26
|
* Parse repeated `--ios-device-matrix <device>:<version>` and
|
|
5
27
|
* `--android-device-matrix <device>:<apiLevel>[:play]` flags into an explicit device
|