@react-native-harness/cli 1.0.0-canary.1764675030942 → 1.0.0-canary.1766225407244
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/bundlers/metro.d.ts +2 -2
- package/dist/bundlers/metro.d.ts.map +1 -1
- package/dist/bundlers/metro.js +24 -47
- package/dist/platforms/android/build.d.ts +2 -3
- package/dist/platforms/android/build.d.ts.map +1 -1
- package/dist/platforms/android/build.js +49 -24
- package/dist/platforms/android/emulator.d.ts +1 -0
- package/dist/platforms/android/emulator.d.ts.map +1 -1
- package/dist/platforms/android/emulator.js +132 -101
- package/dist/platforms/android/index.d.ts.map +1 -1
- package/dist/platforms/android/index.js +19 -23
- package/dist/platforms/ios/build.d.ts +7 -5
- package/dist/platforms/ios/build.d.ts.map +1 -1
- package/dist/platforms/ios/build.js +116 -41
- package/dist/platforms/ios/index.d.ts.map +1 -1
- package/dist/platforms/ios/index.js +32 -24
- package/dist/platforms/ios/simulator.d.ts +4 -4
- package/dist/platforms/ios/simulator.d.ts.map +1 -1
- package/dist/platforms/ios/simulator.js +131 -104
- package/dist/platforms/platform-adapter.d.ts +4 -2
- package/dist/platforms/platform-adapter.d.ts.map +1 -1
- package/dist/platforms/platform-registry.d.ts.map +1 -1
- package/dist/platforms/platform-registry.js +1 -5
- package/dist/platforms/web/index.d.ts +1 -3
- package/dist/platforms/web/index.d.ts.map +1 -1
- package/dist/platforms/web/index.js +50 -9
- package/dist/process.js +1 -1
- package/dist/reporters/default-reporter.d.ts.map +1 -1
- package/dist/reporters/default-reporter.js +17 -22
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/dist/commands/test.d.ts +0 -3
- package/dist/commands/test.d.ts.map +0 -1
- package/dist/commands/test.js +0 -140
- package/dist/discovery/index.d.ts +0 -3
- package/dist/discovery/index.d.ts.map +0 -1
- package/dist/discovery/index.js +0 -1
- package/dist/discovery/testDiscovery.d.ts +0 -11
- package/dist/discovery/testDiscovery.d.ts.map +0 -1
- package/dist/discovery/testDiscovery.js +0 -29
- package/dist/errors/appNotInstalledError.d.ts +0 -7
- package/dist/errors/appNotInstalledError.d.ts.map +0 -1
- package/dist/errors/appNotInstalledError.js +0 -12
- package/dist/errors/bridgeTimeoutError.d.ts +0 -7
- package/dist/errors/bridgeTimeoutError.d.ts.map +0 -1
- package/dist/errors/bridgeTimeoutError.js +0 -12
- package/dist/errors/errorHandler.d.ts +0 -2
- package/dist/errors/errorHandler.d.ts.map +0 -1
- package/dist/errors/errorHandler.js +0 -152
- package/dist/errors/errors.d.ts +0 -45
- package/dist/errors/errors.d.ts.map +0 -1
- package/dist/errors/errors.js +0 -89
- package/dist/jest.d.ts +0 -2
- package/dist/jest.d.ts.map +0 -1
- package/dist/jest.js +0 -7
- package/dist/platforms/android/device.d.ts +0 -5
- package/dist/platforms/android/device.d.ts.map +0 -1
- package/dist/platforms/android/device.js +0 -36
- package/dist/platforms/ios/device.d.ts +0 -11
- package/dist/platforms/ios/device.d.ts.map +0 -1
- package/dist/platforms/ios/device.js +0 -51
- package/dist/platforms/vega/build.d.ts +0 -23
- package/dist/platforms/vega/build.d.ts.map +0 -1
- package/dist/platforms/vega/build.js +0 -55
- package/dist/platforms/vega/device.d.ts +0 -57
- package/dist/platforms/vega/device.d.ts.map +0 -1
- package/dist/platforms/vega/device.js +0 -206
- package/dist/platforms/vega/index.d.ts +0 -4
- package/dist/platforms/vega/index.d.ts.map +0 -1
- package/dist/platforms/vega/index.js +0 -75
- package/dist/reporters/junit-reporter.d.ts +0 -3
- package/dist/reporters/junit-reporter.d.ts.map +0 -1
- package/dist/reporters/junit-reporter.js +0 -119
- package/dist/reporters/live-reporter.d.ts +0 -20
- package/dist/reporters/live-reporter.d.ts.map +0 -1
- package/dist/reporters/live-reporter.js +0 -176
- package/dist/src/reporters/default-reporter.js +0 -135
- package/dist/test-reporter-demo.js +0 -95
- package/dist/utils/status-formatter.d.ts +0 -27
- package/dist/utils/status-formatter.d.ts.map +0 -1
- package/dist/utils/status-formatter.js +0 -54
- package/dist/utils.d.ts +0 -6
- package/dist/utils.d.ts.map +0 -1
- package/dist/utils.js +0 -26
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { spawn, spawnAndForget } from '@react-native-harness/tools';
|
|
2
|
-
export const listDevices = async () => {
|
|
3
|
-
const { stdout } = await spawn('xcrun', [
|
|
4
|
-
'simctl',
|
|
5
|
-
'list',
|
|
6
|
-
'devices',
|
|
7
|
-
'--json',
|
|
8
|
-
]);
|
|
9
|
-
return JSON.parse(stdout);
|
|
10
|
-
};
|
|
11
|
-
export const getDeviceByName = async (simulatorName) => {
|
|
12
|
-
const devices = await listDevices();
|
|
13
|
-
for (const runtime in devices.devices) {
|
|
14
|
-
const runtimeDevices = devices.devices[runtime];
|
|
15
|
-
for (const device of runtimeDevices) {
|
|
16
|
-
if (device.name === simulatorName && device.isAvailable) {
|
|
17
|
-
return device;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return null;
|
|
22
|
-
};
|
|
23
|
-
export const listApps = async (udid) => {
|
|
24
|
-
const { stdout: plistOutput } = await spawn('xcrun', [
|
|
25
|
-
'simctl',
|
|
26
|
-
'listapps',
|
|
27
|
-
udid,
|
|
28
|
-
]);
|
|
29
|
-
const { stdout: jsonOutput } = await spawn('plutil', ['-convert', 'json', '-o', '-', '-'], { stdin: { string: plistOutput } });
|
|
30
|
-
return Object.keys(JSON.parse(jsonOutput));
|
|
31
|
-
};
|
|
32
|
-
export const isAppInstalled = async (simulatorName, bundleId) => {
|
|
33
|
-
const device = await getDeviceByName(simulatorName);
|
|
34
|
-
if (!device) {
|
|
35
|
-
throw new Error(`Simulator ${simulatorName} not found`);
|
|
36
|
-
}
|
|
37
|
-
const appList = await listApps(device.udid);
|
|
38
|
-
return appList.includes(bundleId);
|
|
39
|
-
};
|
|
40
|
-
export const runApp = async (simulatorName, appName) => {
|
|
41
|
-
await killApp(simulatorName, appName);
|
|
42
|
-
await spawn('xcrun', ['simctl', 'launch', simulatorName, appName]);
|
|
43
|
-
};
|
|
44
|
-
export const killApp = async (simulatorName, appName) => {
|
|
45
|
-
await spawnAndForget('xcrun', [
|
|
46
|
-
'simctl',
|
|
47
|
-
'terminate',
|
|
48
|
-
simulatorName,
|
|
49
|
-
appName,
|
|
50
|
-
]);
|
|
51
|
-
};
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
export type VegaBuildTarget = 'sim_tv_x86_64' | 'sim_tv_aarch64';
|
|
2
|
-
export type VegaBuildType = 'Debug' | 'Release';
|
|
3
|
-
/**
|
|
4
|
-
* Build Vega app and produce .vpkg file
|
|
5
|
-
*/
|
|
6
|
-
export declare const buildVegaApp: (buildType?: VegaBuildType, target?: VegaBuildTarget) => Promise<void>;
|
|
7
|
-
/**
|
|
8
|
-
* Clean build artifacts
|
|
9
|
-
*/
|
|
10
|
-
export declare const cleanBuild: () => Promise<void>;
|
|
11
|
-
/**
|
|
12
|
-
* Get the expected .vpkg file path based on build configuration
|
|
13
|
-
*/
|
|
14
|
-
export declare const getVpkgPath: (appName: string, buildType?: VegaBuildType, target?: VegaBuildTarget) => string;
|
|
15
|
-
/**
|
|
16
|
-
* Launch an already installed app on specified Vega virtual device
|
|
17
|
-
*/
|
|
18
|
-
export declare const runApp: (deviceId: string, bundleId: string) => Promise<void>;
|
|
19
|
-
/**
|
|
20
|
-
* Kill/terminate app on specified Vega virtual device
|
|
21
|
-
*/
|
|
22
|
-
export declare const killApp: (deviceId: string, bundleId: string) => Promise<void>;
|
|
23
|
-
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/platforms/vega/build.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,eAAe,GAAG,eAAe,GAAG,gBAAgB,CAAC;AACjE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,CAAC;AAEhD;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,YAAW,aAAyB,EACpC,SAAS,eAAe,KACvB,OAAO,CAAC,IAAI,CAYd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,QAAa,OAAO,CAAC,IAAI,CAE/C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EACf,YAAW,aAAyB,EACpC,SAAQ,eAAiC,KACxC,MAUF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,GACjB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAClB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { spawn } from '@react-native-harness/tools';
|
|
3
|
-
/**
|
|
4
|
-
* Build Vega app and produce .vpkg file
|
|
5
|
-
*/
|
|
6
|
-
export const buildVegaApp = async (buildType = 'Release', target) => {
|
|
7
|
-
const args = ['run', 'build:app'];
|
|
8
|
-
if (buildType) {
|
|
9
|
-
args.push('-b', buildType);
|
|
10
|
-
}
|
|
11
|
-
if (target) {
|
|
12
|
-
args.push('-t', target);
|
|
13
|
-
}
|
|
14
|
-
await spawn('npm', args);
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Clean build artifacts
|
|
18
|
-
*/
|
|
19
|
-
export const cleanBuild = async () => {
|
|
20
|
-
await spawn('kepler', ['clean']);
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Get the expected .vpkg file path based on build configuration
|
|
24
|
-
*/
|
|
25
|
-
export const getVpkgPath = (appName, buildType = 'Release', target = 'sim_tv_x86_64') => {
|
|
26
|
-
const buildTypeStr = buildType.toLowerCase();
|
|
27
|
-
const vpkgFileName = `${appName}_${target}.vpkg`;
|
|
28
|
-
return path.join(process.cwd(), 'build', `${target}-${buildTypeStr}`, vpkgFileName);
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Launch an already installed app on specified Vega virtual device
|
|
32
|
-
*/
|
|
33
|
-
export const runApp = async (deviceId, bundleId) => {
|
|
34
|
-
await spawn('kepler', [
|
|
35
|
-
'device',
|
|
36
|
-
'launch-app',
|
|
37
|
-
'--device',
|
|
38
|
-
deviceId,
|
|
39
|
-
'--appName',
|
|
40
|
-
bundleId,
|
|
41
|
-
]);
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Kill/terminate app on specified Vega virtual device
|
|
45
|
-
*/
|
|
46
|
-
export const killApp = async (deviceId, bundleId) => {
|
|
47
|
-
await spawn('kepler', [
|
|
48
|
-
'device',
|
|
49
|
-
'terminate-app',
|
|
50
|
-
'--device',
|
|
51
|
-
deviceId,
|
|
52
|
-
'--appName',
|
|
53
|
-
bundleId,
|
|
54
|
-
]);
|
|
55
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
export type VegaVirtualDeviceStatus = 'running' | 'stopped';
|
|
2
|
-
/**
|
|
3
|
-
* List all available Vega virtual devices
|
|
4
|
-
* Returns array of device identifiers that can be used with kepler commands
|
|
5
|
-
*/
|
|
6
|
-
export declare const listVegaDevices: () => Promise<string[]>;
|
|
7
|
-
/**
|
|
8
|
-
* Check if a specific Vega virtual device is connected/available
|
|
9
|
-
*/
|
|
10
|
-
export declare const isVegaDeviceConnected: (deviceId: string) => Promise<boolean>;
|
|
11
|
-
/**
|
|
12
|
-
* Check if an app is installed on the specified Vega virtual device
|
|
13
|
-
*/
|
|
14
|
-
export declare const isAppInstalled: (deviceId: string, bundleId: string) => Promise<boolean>;
|
|
15
|
-
/**
|
|
16
|
-
* Check if an app is currently running on the specified Vega virtual device
|
|
17
|
-
*/
|
|
18
|
-
export declare const isAppRunning: (deviceId: string, bundleId: string) => Promise<boolean>;
|
|
19
|
-
/**
|
|
20
|
-
* Install app on specified Vega virtual device using .vpkg file
|
|
21
|
-
*/
|
|
22
|
-
export declare const installApp: (deviceId: string, vpkgPath: string) => Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Terminate app on specified Vega virtual device
|
|
25
|
-
*/
|
|
26
|
-
export declare const terminateApp: (deviceId: string, bundleId: string) => Promise<void>;
|
|
27
|
-
/**
|
|
28
|
-
* Uninstall app from specified Vega virtual device
|
|
29
|
-
*/
|
|
30
|
-
export declare const uninstallApp: (deviceId: string, bundleId: string) => Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Start port forwarding for debugging on specified Vega virtual device
|
|
33
|
-
*/
|
|
34
|
-
export declare const startPortForwarding: (deviceId: string, port: number, forward?: boolean) => Promise<void>;
|
|
35
|
-
/**
|
|
36
|
-
* Stop port forwarding on specified Vega virtual device
|
|
37
|
-
*/
|
|
38
|
-
export declare const stopPortForwarding: (deviceId: string, port: number, forward?: boolean) => Promise<void>;
|
|
39
|
-
/**
|
|
40
|
-
* Get status of a specific Vega virtual device
|
|
41
|
-
* Note: Vega CLI might manage virtual devices globally, so this checks if the device is available
|
|
42
|
-
*/
|
|
43
|
-
export declare const getVegaDeviceStatus: (deviceId: string) => Promise<VegaVirtualDeviceStatus>;
|
|
44
|
-
/**
|
|
45
|
-
* Start Vega Virtual Device
|
|
46
|
-
* Note: Vega might manage virtual devices globally, this starts the virtual device system
|
|
47
|
-
*/
|
|
48
|
-
export declare const startVirtualDevice: () => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* Stop Vega Virtual Device
|
|
51
|
-
*/
|
|
52
|
-
export declare const stopVirtualDevice: () => Promise<void>;
|
|
53
|
-
/**
|
|
54
|
-
* Combined install and run command for specified Vega virtual device (Vega-specific convenience method)
|
|
55
|
-
*/
|
|
56
|
-
export declare const runKepler: (deviceId: string, vpkgPath: string, bundleId: string) => Promise<void>;
|
|
57
|
-
//# sourceMappingURL=device.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../src/platforms/vega/device.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG,SAAS,GAAG,SAAS,CAAC;AAE5D;;;GAGG;AACH,eAAO,MAAM,eAAe,QAAa,OAAO,CAAC,MAAM,EAAE,CAwBxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,GAChC,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAYjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GACzB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAcjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAcjB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GACrB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GACvB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CASd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,EAChB,MAAM,MAAM,EACZ,iBAAc,KACb,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,UAAU,MAAM,EAChB,MAAM,MAAM,EACZ,iBAAc,KACb,OAAO,CAAC,IAAI,CAWd,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAC9B,UAAU,MAAM,KACf,OAAO,CAAC,uBAAuB,CAkBjC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAa,OAAO,CAAC,IAAI,CAqBvD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB,QAAa,OAAO,CAAC,IAAI,CAEtD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GACpB,UAAU,MAAM,EAChB,UAAU,MAAM,EAChB,UAAU,MAAM,KACf,OAAO,CAAC,IAAI,CAEd,CAAC"}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import { spawn } from '@react-native-harness/tools';
|
|
2
|
-
/**
|
|
3
|
-
* List all available Vega virtual devices
|
|
4
|
-
* Returns array of device identifiers that can be used with kepler commands
|
|
5
|
-
*/
|
|
6
|
-
export const listVegaDevices = async () => {
|
|
7
|
-
try {
|
|
8
|
-
const { stdout } = await spawn('kepler', ['device', 'list']);
|
|
9
|
-
const lines = stdout.trim().split('\n');
|
|
10
|
-
const devices = [];
|
|
11
|
-
for (const line of lines) {
|
|
12
|
-
if (line.trim()) {
|
|
13
|
-
// Parse device line format: "VirtualDevice : tv - x86_64 - OS - hostname"
|
|
14
|
-
// or potentially "VegaTV_1 : tv - x86_64 - OS - hostname" for named instances
|
|
15
|
-
const deviceId = line.split(' : ')[0].trim();
|
|
16
|
-
if (deviceId &&
|
|
17
|
-
(deviceId === 'VirtualDevice' || deviceId.startsWith('Vega'))) {
|
|
18
|
-
devices.push(deviceId);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
return devices;
|
|
23
|
-
}
|
|
24
|
-
catch {
|
|
25
|
-
return [];
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* Check if a specific Vega virtual device is connected/available
|
|
30
|
-
*/
|
|
31
|
-
export const isVegaDeviceConnected = async (deviceId) => {
|
|
32
|
-
try {
|
|
33
|
-
const { stdout } = await spawn('kepler', [
|
|
34
|
-
'device',
|
|
35
|
-
'is-connected',
|
|
36
|
-
'--device',
|
|
37
|
-
deviceId,
|
|
38
|
-
]);
|
|
39
|
-
return stdout.includes('is connected');
|
|
40
|
-
}
|
|
41
|
-
catch {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
/**
|
|
46
|
-
* Check if an app is installed on the specified Vega virtual device
|
|
47
|
-
*/
|
|
48
|
-
export const isAppInstalled = async (deviceId, bundleId) => {
|
|
49
|
-
try {
|
|
50
|
-
await spawn('kepler', [
|
|
51
|
-
'device',
|
|
52
|
-
'is-app-installed',
|
|
53
|
-
'--device',
|
|
54
|
-
deviceId,
|
|
55
|
-
'--appName',
|
|
56
|
-
bundleId,
|
|
57
|
-
]);
|
|
58
|
-
return true;
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return false;
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
/**
|
|
65
|
-
* Check if an app is currently running on the specified Vega virtual device
|
|
66
|
-
*/
|
|
67
|
-
export const isAppRunning = async (deviceId, bundleId) => {
|
|
68
|
-
try {
|
|
69
|
-
await spawn('kepler', [
|
|
70
|
-
'device',
|
|
71
|
-
'is-app-running',
|
|
72
|
-
'--device',
|
|
73
|
-
deviceId,
|
|
74
|
-
'--appName',
|
|
75
|
-
bundleId,
|
|
76
|
-
]);
|
|
77
|
-
return true;
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
/**
|
|
84
|
-
* Install app on specified Vega virtual device using .vpkg file
|
|
85
|
-
*/
|
|
86
|
-
export const installApp = async (deviceId, vpkgPath) => {
|
|
87
|
-
await spawn('kepler', [
|
|
88
|
-
'device',
|
|
89
|
-
'install-app',
|
|
90
|
-
'-p',
|
|
91
|
-
vpkgPath,
|
|
92
|
-
'--device',
|
|
93
|
-
deviceId,
|
|
94
|
-
]);
|
|
95
|
-
};
|
|
96
|
-
/**
|
|
97
|
-
* Terminate app on specified Vega virtual device
|
|
98
|
-
*/
|
|
99
|
-
export const terminateApp = async (deviceId, bundleId) => {
|
|
100
|
-
await spawn('kepler', [
|
|
101
|
-
'device',
|
|
102
|
-
'terminate-app',
|
|
103
|
-
'--device',
|
|
104
|
-
deviceId,
|
|
105
|
-
'--appName',
|
|
106
|
-
bundleId,
|
|
107
|
-
]);
|
|
108
|
-
};
|
|
109
|
-
/**
|
|
110
|
-
* Uninstall app from specified Vega virtual device
|
|
111
|
-
*/
|
|
112
|
-
export const uninstallApp = async (deviceId, bundleId) => {
|
|
113
|
-
await spawn('kepler', [
|
|
114
|
-
'device',
|
|
115
|
-
'uninstall-app',
|
|
116
|
-
'--device',
|
|
117
|
-
deviceId,
|
|
118
|
-
'--appName',
|
|
119
|
-
bundleId,
|
|
120
|
-
]);
|
|
121
|
-
};
|
|
122
|
-
/**
|
|
123
|
-
* Start port forwarding for debugging on specified Vega virtual device
|
|
124
|
-
*/
|
|
125
|
-
export const startPortForwarding = async (deviceId, port, forward = true) => {
|
|
126
|
-
await spawn('kepler', [
|
|
127
|
-
'device',
|
|
128
|
-
'start-port-forwarding',
|
|
129
|
-
'--device',
|
|
130
|
-
deviceId,
|
|
131
|
-
'--port',
|
|
132
|
-
port.toString(),
|
|
133
|
-
'--forward',
|
|
134
|
-
forward.toString(),
|
|
135
|
-
]);
|
|
136
|
-
};
|
|
137
|
-
/**
|
|
138
|
-
* Stop port forwarding on specified Vega virtual device
|
|
139
|
-
*/
|
|
140
|
-
export const stopPortForwarding = async (deviceId, port, forward = true) => {
|
|
141
|
-
await spawn('kepler', [
|
|
142
|
-
'device',
|
|
143
|
-
'stop-port-forwarding',
|
|
144
|
-
'--device',
|
|
145
|
-
deviceId,
|
|
146
|
-
'--port',
|
|
147
|
-
port.toString(),
|
|
148
|
-
'--forward',
|
|
149
|
-
forward.toString(),
|
|
150
|
-
]);
|
|
151
|
-
};
|
|
152
|
-
/**
|
|
153
|
-
* Get status of a specific Vega virtual device
|
|
154
|
-
* Note: Vega CLI might manage virtual devices globally, so this checks if the device is available
|
|
155
|
-
*/
|
|
156
|
-
export const getVegaDeviceStatus = async (deviceId) => {
|
|
157
|
-
try {
|
|
158
|
-
// First check if the device is connected/available
|
|
159
|
-
const isConnected = await isVegaDeviceConnected(deviceId);
|
|
160
|
-
if (isConnected) {
|
|
161
|
-
return 'running';
|
|
162
|
-
}
|
|
163
|
-
// Check general virtual device status
|
|
164
|
-
const { stdout } = await spawn('kepler', ['virtual-device', 'status']);
|
|
165
|
-
// Parse the status output to determine if VVD is running
|
|
166
|
-
return stdout.toLowerCase().includes('running') ||
|
|
167
|
-
stdout.toLowerCase().includes('ready')
|
|
168
|
-
? 'running'
|
|
169
|
-
: 'stopped';
|
|
170
|
-
}
|
|
171
|
-
catch {
|
|
172
|
-
return 'stopped';
|
|
173
|
-
}
|
|
174
|
-
};
|
|
175
|
-
/**
|
|
176
|
-
* Start Vega Virtual Device
|
|
177
|
-
* Note: Vega might manage virtual devices globally, this starts the virtual device system
|
|
178
|
-
*/
|
|
179
|
-
export const startVirtualDevice = async () => {
|
|
180
|
-
await spawn('kepler', ['virtual-device', 'start']);
|
|
181
|
-
// Poll for VVD status until it's running
|
|
182
|
-
let attempts = 0;
|
|
183
|
-
const maxAttempts = 30; // 30 seconds timeout
|
|
184
|
-
while (attempts < maxAttempts) {
|
|
185
|
-
const { stdout } = await spawn('kepler', ['virtual-device', 'status']);
|
|
186
|
-
if (stdout.toLowerCase().includes('running') ||
|
|
187
|
-
stdout.toLowerCase().includes('ready')) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
191
|
-
attempts++;
|
|
192
|
-
}
|
|
193
|
-
throw new Error('Vega Virtual Device failed to start within timeout');
|
|
194
|
-
};
|
|
195
|
-
/**
|
|
196
|
-
* Stop Vega Virtual Device
|
|
197
|
-
*/
|
|
198
|
-
export const stopVirtualDevice = async () => {
|
|
199
|
-
await spawn('kepler', ['virtual-device', 'stop']);
|
|
200
|
-
};
|
|
201
|
-
/**
|
|
202
|
-
* Combined install and run command for specified Vega virtual device (Vega-specific convenience method)
|
|
203
|
-
*/
|
|
204
|
-
export const runKepler = async (deviceId, vpkgPath, bundleId) => {
|
|
205
|
-
await spawn('kepler', ['run-kepler', vpkgPath, bundleId, '-d', deviceId]);
|
|
206
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/platforms/vega/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAe9D,QAAA,MAAM,mBAAmB,EAAE,eAmF1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { assertVegaRunnerConfig, } from '@react-native-harness/config';
|
|
2
|
-
import { logger } from '@react-native-harness/tools';
|
|
3
|
-
import { isAppInstalled, getVegaDeviceStatus, isVegaDeviceConnected, startVirtualDevice, stopVirtualDevice, startPortForwarding, stopPortForwarding, } from './device.js';
|
|
4
|
-
import { runApp, killApp } from './build.js';
|
|
5
|
-
import { killWithAwait } from '../../process.js';
|
|
6
|
-
import { runMetro } from '../../bundlers/metro.js';
|
|
7
|
-
import { AppNotInstalledError } from '../../errors/errors.js';
|
|
8
|
-
const vegaPlatformAdapter = {
|
|
9
|
-
name: 'vega',
|
|
10
|
-
getEnvironment: async (runner) => {
|
|
11
|
-
assertVegaRunnerConfig(runner);
|
|
12
|
-
let shouldStopVirtualDevice = false;
|
|
13
|
-
// Check if the specific Vega device is available
|
|
14
|
-
const deviceStatus = await getVegaDeviceStatus(runner.deviceId);
|
|
15
|
-
logger.debug(`Vega device ${runner.deviceId} status: ${deviceStatus}`);
|
|
16
|
-
if (deviceStatus === 'stopped') {
|
|
17
|
-
logger.debug('Starting Vega Virtual Device system');
|
|
18
|
-
await startVirtualDevice();
|
|
19
|
-
shouldStopVirtualDevice = true;
|
|
20
|
-
// Wait a bit for the device to become available
|
|
21
|
-
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
22
|
-
}
|
|
23
|
-
// Verify device is now connected
|
|
24
|
-
const isConnected = await isVegaDeviceConnected(runner.deviceId);
|
|
25
|
-
if (!isConnected) {
|
|
26
|
-
throw new Error(`Vega device ${runner.deviceId} is not available. Make sure the virtual device is configured and running.`);
|
|
27
|
-
}
|
|
28
|
-
// Start Metro bundler
|
|
29
|
-
const metroPromise = runMetro();
|
|
30
|
-
// Set up port forwarding for debugging (similar to Android)
|
|
31
|
-
await Promise.all([
|
|
32
|
-
startPortForwarding(runner.deviceId, 8081, false), // reverse port forwarding for JS debugging
|
|
33
|
-
startPortForwarding(runner.deviceId, 8080, false),
|
|
34
|
-
startPortForwarding(runner.deviceId, 3001, false),
|
|
35
|
-
]);
|
|
36
|
-
logger.debug('Port forwarding established');
|
|
37
|
-
// Check if app is installed
|
|
38
|
-
const isInstalled = await isAppInstalled(runner.deviceId, runner.bundleId);
|
|
39
|
-
logger.debug(`App is installed: ${isInstalled}`);
|
|
40
|
-
if (!isInstalled) {
|
|
41
|
-
throw new AppNotInstalledError(runner.deviceId, runner.bundleId, 'vega');
|
|
42
|
-
}
|
|
43
|
-
logger.debug('Waiting for Metro to start');
|
|
44
|
-
const metro = await metroPromise;
|
|
45
|
-
logger.debug('Metro started');
|
|
46
|
-
logger.debug('Running Vega app');
|
|
47
|
-
await runApp(runner.deviceId, runner.bundleId);
|
|
48
|
-
logger.debug('Vega app running');
|
|
49
|
-
return {
|
|
50
|
-
restart: async () => {
|
|
51
|
-
await runApp(runner.deviceId, runner.bundleId);
|
|
52
|
-
},
|
|
53
|
-
dispose: async () => {
|
|
54
|
-
// Kill the app
|
|
55
|
-
await killApp(runner.deviceId, runner.bundleId);
|
|
56
|
-
// Stop port forwarding
|
|
57
|
-
await Promise.all([
|
|
58
|
-
stopPortForwarding(runner.deviceId, 8081, false),
|
|
59
|
-
stopPortForwarding(runner.deviceId, 8080, false),
|
|
60
|
-
stopPortForwarding(runner.deviceId, 3001, false),
|
|
61
|
-
]).catch((error) => {
|
|
62
|
-
// Don't fail disposal if port forwarding cleanup fails
|
|
63
|
-
logger.debug(`Port forwarding cleanup failed: ${error.message}`);
|
|
64
|
-
});
|
|
65
|
-
// Stop Virtual Device if we started it
|
|
66
|
-
if (shouldStopVirtualDevice) {
|
|
67
|
-
await stopVirtualDevice();
|
|
68
|
-
}
|
|
69
|
-
// Kill Metro
|
|
70
|
-
await killWithAwait(metro);
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
export default vegaPlatformAdapter;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"junit-reporter.d.ts","sourceRoot":"","sources":["../../src/reporters/junit-reporter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAKxD,eAAO,MAAM,aAAa,EAAE,QAU3B,CAAC"}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import { writeFileSync } from 'fs';
|
|
2
|
-
import { join } from 'path';
|
|
3
|
-
export const junitReporter = {
|
|
4
|
-
report: async (results) => {
|
|
5
|
-
const xml = generateJUnitXML(results);
|
|
6
|
-
// Write to junit.xml file
|
|
7
|
-
const outputPath = join(process.cwd(), 'junit.xml');
|
|
8
|
-
writeFileSync(outputPath, xml, 'utf8');
|
|
9
|
-
console.log(`📄 JUnit report written to: ${outputPath}`);
|
|
10
|
-
},
|
|
11
|
-
};
|
|
12
|
-
const generateJUnitXML = (results) => {
|
|
13
|
-
const { totalTests, totalFailures, totalSkipped, totalTime } = calculateTotals(results);
|
|
14
|
-
let xml = '<?xml version="1.0" encoding="UTF-8"?>\n';
|
|
15
|
-
xml += `<testsuites tests="${totalTests}" failures="${totalFailures}" skipped="${totalSkipped}" time="${totalTime / 1000}">\n`;
|
|
16
|
-
for (const suite of results) {
|
|
17
|
-
xml += generateTestSuiteXML(suite, ' ');
|
|
18
|
-
}
|
|
19
|
-
xml += '</testsuites>\n';
|
|
20
|
-
return xml;
|
|
21
|
-
};
|
|
22
|
-
const generateTestSuiteXML = (suite, indent) => {
|
|
23
|
-
const { tests, failures, skipped, time } = getSuiteStats(suite);
|
|
24
|
-
let xml = `${indent}<testsuite name="${escapeXML(suite.name)}" tests="${tests}" failures="${failures}" skipped="${skipped}" time="${time / 1000}"`;
|
|
25
|
-
if (suite.error) {
|
|
26
|
-
xml += ` errors="1"`;
|
|
27
|
-
}
|
|
28
|
-
xml += '>\n';
|
|
29
|
-
// Add suite-level error if present
|
|
30
|
-
if (suite.error) {
|
|
31
|
-
xml += `${indent} <error message="${escapeXML(suite.error.message || 'Suite failed')}"`;
|
|
32
|
-
if (suite.error.name) {
|
|
33
|
-
xml += ` type="${escapeXML(suite.error.name)}"`;
|
|
34
|
-
}
|
|
35
|
-
xml += '>';
|
|
36
|
-
if (suite.error.stack) {
|
|
37
|
-
xml += escapeXML(suite.error.stack);
|
|
38
|
-
}
|
|
39
|
-
xml += '</error>\n';
|
|
40
|
-
}
|
|
41
|
-
// Add individual test cases
|
|
42
|
-
for (const test of suite.tests) {
|
|
43
|
-
xml += generateTestCaseXML(test, indent + ' ');
|
|
44
|
-
}
|
|
45
|
-
// Add nested suites
|
|
46
|
-
for (const nestedSuite of suite.suites) {
|
|
47
|
-
xml += generateTestSuiteXML(nestedSuite, indent + ' ');
|
|
48
|
-
}
|
|
49
|
-
xml += `${indent}</testsuite>\n`;
|
|
50
|
-
return xml;
|
|
51
|
-
};
|
|
52
|
-
const generateTestCaseXML = (test, indent) => {
|
|
53
|
-
const time = (test.duration || 0) / 1000;
|
|
54
|
-
let xml = `${indent}<testcase name="${escapeXML(test.name)}" time="${time}"`;
|
|
55
|
-
if (test.status === 'passed') {
|
|
56
|
-
xml += '/>\n';
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
xml += '>\n';
|
|
60
|
-
switch (test.status) {
|
|
61
|
-
case 'failed':
|
|
62
|
-
xml += `${indent} <failure message="${escapeXML(test.error?.message || 'Test failed')}"`;
|
|
63
|
-
if (test.error?.name) {
|
|
64
|
-
xml += ` type="${escapeXML(test.error.name)}"`;
|
|
65
|
-
}
|
|
66
|
-
xml += '>';
|
|
67
|
-
if (test.error?.stack) {
|
|
68
|
-
xml += escapeXML(test.error.stack);
|
|
69
|
-
}
|
|
70
|
-
xml += '</failure>\n';
|
|
71
|
-
break;
|
|
72
|
-
case 'skipped':
|
|
73
|
-
xml += `${indent} <skipped/>\n`;
|
|
74
|
-
break;
|
|
75
|
-
case 'todo':
|
|
76
|
-
xml += `${indent} <skipped message="TODO: Test not implemented"/>\n`;
|
|
77
|
-
break;
|
|
78
|
-
}
|
|
79
|
-
xml += `${indent}</testcase>\n`;
|
|
80
|
-
}
|
|
81
|
-
return xml;
|
|
82
|
-
};
|
|
83
|
-
const calculateTotals = (results) => {
|
|
84
|
-
let totalTests = 0;
|
|
85
|
-
let totalFailures = 0;
|
|
86
|
-
let totalSkipped = 0;
|
|
87
|
-
let totalTime = 0;
|
|
88
|
-
for (const suite of results) {
|
|
89
|
-
const stats = getSuiteStats(suite);
|
|
90
|
-
totalTests += stats.tests;
|
|
91
|
-
totalFailures += stats.failures;
|
|
92
|
-
totalSkipped += stats.skipped;
|
|
93
|
-
totalTime += stats.time;
|
|
94
|
-
}
|
|
95
|
-
return { totalTests, totalFailures, totalSkipped, totalTime };
|
|
96
|
-
};
|
|
97
|
-
const getSuiteStats = (suite) => {
|
|
98
|
-
let tests = suite.tests.length;
|
|
99
|
-
let failures = suite.tests.filter((t) => t.status === 'failed').length;
|
|
100
|
-
let skipped = suite.tests.filter((t) => t.status === 'skipped' || t.status === 'todo').length;
|
|
101
|
-
let time = suite.duration || 0;
|
|
102
|
-
// Add stats from nested suites
|
|
103
|
-
for (const nestedSuite of suite.suites) {
|
|
104
|
-
const nestedStats = getSuiteStats(nestedSuite);
|
|
105
|
-
tests += nestedStats.tests;
|
|
106
|
-
failures += nestedStats.failures;
|
|
107
|
-
skipped += nestedStats.skipped;
|
|
108
|
-
time += nestedStats.time;
|
|
109
|
-
}
|
|
110
|
-
return { tests, failures, skipped, time };
|
|
111
|
-
};
|
|
112
|
-
const escapeXML = (str) => {
|
|
113
|
-
return str
|
|
114
|
-
.replace(/&/g, '&')
|
|
115
|
-
.replace(/</g, '<')
|
|
116
|
-
.replace(/>/g, '>')
|
|
117
|
-
.replace(/"/g, '"')
|
|
118
|
-
.replace(/'/g, ''');
|
|
119
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { SuiteResult, LiveReportingEvent } from '@react-native-harness/bridge';
|
|
2
|
-
import { Reporter } from '@react-native-harness/config';
|
|
3
|
-
export declare class LiveReporter {
|
|
4
|
-
private state;
|
|
5
|
-
private progressSpinner;
|
|
6
|
-
constructor();
|
|
7
|
-
start(): void;
|
|
8
|
-
handleLiveEvent(event: LiveReportingEvent): void;
|
|
9
|
-
private getStatusSymbol;
|
|
10
|
-
private updateProgress;
|
|
11
|
-
private formatDuration;
|
|
12
|
-
stop(message: string): void;
|
|
13
|
-
countTests(suite: SuiteResult): number;
|
|
14
|
-
setTotalTests(results: SuiteResult[]): void;
|
|
15
|
-
}
|
|
16
|
-
export declare const createLiveReporter: () => {
|
|
17
|
-
reporter: Reporter;
|
|
18
|
-
liveReporter: LiveReporter;
|
|
19
|
-
};
|
|
20
|
-
//# sourceMappingURL=live-reporter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"live-reporter.d.ts","sourceRoot":"","sources":["../../src/reporters/live-reporter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,WAAW,EAEX,kBAAkB,EACnB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAcxD,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAoB;IACjC,OAAO,CAAC,eAAe,CAA6B;;IAiBpD,KAAK;IAKL,eAAe,CAAC,KAAK,EAAE,kBAAkB;IA4DzC,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,cAAc;IA6BtB,OAAO,CAAC,cAAc;IAMtB,IAAI,CAAC,OAAO,EAAE,MAAM;IAKpB,UAAU,CAAC,KAAK,EAAE,WAAW,GAAG,MAAM;IAQtC,aAAa,CAAC,OAAO,EAAE,WAAW,EAAE;CAMrC;AAED,eAAO,MAAM,kBAAkB,QAAO;IACpC,QAAQ,EAAE,QAAQ,CAAC;IACnB,YAAY,EAAE,YAAY,CAAC;CA0C5B,CAAC"}
|