@react-native-harness/cli 1.0.0-alpha.9 → 1.0.0-canary.1761729829908

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.
Files changed (76) hide show
  1. package/README.md +23 -4
  2. package/dist/bundlers/metro.d.ts.map +1 -1
  3. package/dist/bundlers/metro.js +15 -5
  4. package/dist/commands/test.d.ts +2 -1
  5. package/dist/commands/test.d.ts.map +1 -1
  6. package/dist/commands/test.js +23 -19
  7. package/dist/discovery/index.d.ts +3 -0
  8. package/dist/discovery/index.d.ts.map +1 -0
  9. package/dist/discovery/index.js +1 -0
  10. package/dist/discovery/testDiscovery.d.ts +11 -0
  11. package/dist/discovery/testDiscovery.d.ts.map +1 -0
  12. package/dist/discovery/testDiscovery.js +29 -0
  13. package/dist/errors/errorHandler.d.ts +1 -1
  14. package/dist/errors/errorHandler.d.ts.map +1 -1
  15. package/dist/errors/errorHandler.js +103 -101
  16. package/dist/errors/errors.d.ts +6 -7
  17. package/dist/errors/errors.d.ts.map +1 -1
  18. package/dist/errors/errors.js +8 -12
  19. package/dist/external.d.ts +2 -0
  20. package/dist/external.d.ts.map +1 -0
  21. package/dist/external.js +1 -0
  22. package/dist/index.js +58 -33
  23. package/dist/jest.d.ts +2 -0
  24. package/dist/jest.d.ts.map +1 -0
  25. package/dist/jest.js +7 -0
  26. package/dist/platforms/android/emulator.d.ts +0 -1
  27. package/dist/platforms/android/emulator.d.ts.map +1 -1
  28. package/dist/platforms/android/emulator.js +26 -20
  29. package/dist/platforms/android/index.js +1 -1
  30. package/dist/platforms/ios/build.d.ts.map +1 -1
  31. package/dist/platforms/ios/build.js +5 -1
  32. package/dist/platforms/ios/device.d.ts +6 -2
  33. package/dist/platforms/ios/device.d.ts.map +1 -1
  34. package/dist/platforms/ios/simulator.d.ts.map +1 -1
  35. package/dist/platforms/ios/simulator.js +8 -3
  36. package/dist/platforms/platform-registry.d.ts.map +1 -1
  37. package/dist/platforms/platform-registry.js +3 -1
  38. package/dist/platforms/vega/build.d.ts +23 -0
  39. package/dist/platforms/vega/build.d.ts.map +1 -0
  40. package/dist/platforms/vega/build.js +55 -0
  41. package/dist/platforms/vega/device.d.ts +57 -0
  42. package/dist/platforms/vega/device.d.ts.map +1 -0
  43. package/dist/platforms/vega/device.js +206 -0
  44. package/dist/platforms/vega/index.d.ts +4 -0
  45. package/dist/platforms/vega/index.d.ts.map +1 -0
  46. package/dist/platforms/vega/index.js +75 -0
  47. package/dist/process.js +1 -1
  48. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  49. package/dist/utils/status-formatter.d.ts +27 -0
  50. package/dist/utils/status-formatter.d.ts.map +1 -0
  51. package/dist/utils/status-formatter.js +54 -0
  52. package/dist/utils.d.ts +1 -0
  53. package/dist/utils.d.ts.map +1 -1
  54. package/dist/utils.js +15 -0
  55. package/eslint.config.mjs +1 -0
  56. package/package.json +25 -9
  57. package/src/external.ts +0 -0
  58. package/src/index.ts +65 -44
  59. package/tsconfig.lib.json +1 -12
  60. package/src/bundlers/metro.ts +0 -89
  61. package/src/commands/test.ts +0 -218
  62. package/src/errors/errorHandler.ts +0 -196
  63. package/src/errors/errors.ts +0 -119
  64. package/src/platforms/android/build.ts +0 -49
  65. package/src/platforms/android/device.ts +0 -48
  66. package/src/platforms/android/emulator.ts +0 -139
  67. package/src/platforms/android/index.ts +0 -87
  68. package/src/platforms/ios/build.ts +0 -68
  69. package/src/platforms/ios/device.ts +0 -76
  70. package/src/platforms/ios/index.ts +0 -66
  71. package/src/platforms/ios/simulator.ts +0 -166
  72. package/src/platforms/platform-adapter.ts +0 -11
  73. package/src/platforms/platform-registry.ts +0 -24
  74. package/src/platforms/web/index.ts +0 -16
  75. package/src/process.ts +0 -33
  76. package/src/utils.ts +0 -12
package/dist/index.js CHANGED
@@ -1,36 +1,61 @@
1
- import { Command } from 'commander';
2
- import { readFileSync } from 'fs';
3
- import { fileURLToPath } from 'url';
4
- import { dirname, join } from 'path';
5
- import { testCommand } from './commands/test.js';
6
- import { handleError } from './errors/errorHandler.js';
7
- import { logger } from '@react-native-harness/tools';
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = dirname(__filename);
10
- const packageJsonPath = join(__dirname, '../package.json');
11
- const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
12
- const program = new Command();
13
- logger.setVerbose(true);
14
- program
15
- .name('react-native-harness')
16
- .description('React Native Test Harness - A comprehensive testing framework for React Native applications')
17
- .version(packageJson.version);
18
- program
19
- .command('test')
20
- .description('Run tests using the specified runner')
21
- .argument('[runner]', 'test runner name (uses defaultRunner from config if not specified)')
22
- .argument('[pattern]', 'glob pattern to match test files (uses config.include if not specified)')
23
- .action(async (runner, pattern) => {
1
+ import { run, yargsOptions } from 'jest-cli';
2
+ import { getConfig } from '@react-native-harness/config';
3
+ const checkForOldConfig = async () => {
24
4
  try {
25
- await testCommand(runner, pattern);
5
+ const { config } = await getConfig(process.cwd());
6
+ if (config.include) {
7
+ console.error('\n❌ Migration Required\n');
8
+ console.error('React Native Harness has migrated to the Jest CLI.');
9
+ console.error('The "include" property in your rn-harness.config file is no longer supported.\n');
10
+ console.error('Please follow the migration guide to update your configuration:');
11
+ console.error('https://react-native-harness.dev/docs/guides/migration-guide\n');
12
+ process.exit(1);
13
+ }
26
14
  }
27
- catch (error) {
28
- handleError(error);
29
- process.exit(1);
15
+ catch {
16
+ // Swallow the error - if we can't load the config, let Jest CLI handle it
30
17
  }
31
- });
32
- process.on('uncaughtException', (error) => {
33
- handleError(error);
34
- process.exit(1);
35
- });
36
- program.parse();
18
+ };
19
+ const patchYargsOptions = () => {
20
+ yargsOptions.harnessRunner = {
21
+ type: 'string',
22
+ description: 'Specify which Harness runner to use',
23
+ requiresArg: true,
24
+ };
25
+ // Remove all options that are not supported by Harness
26
+ delete yargsOptions.runner;
27
+ delete yargsOptions.testRunner;
28
+ delete yargsOptions.testEnvironment;
29
+ delete yargsOptions.testEnvironmentOptions;
30
+ delete yargsOptions.transform;
31
+ delete yargsOptions.transformIgnorePatterns;
32
+ delete yargsOptions.updateSnapshot;
33
+ delete yargsOptions.workerThreads;
34
+ delete yargsOptions.snapshotSerializers;
35
+ delete yargsOptions.shard;
36
+ delete yargsOptions.runInBand;
37
+ delete yargsOptions.resolver;
38
+ delete yargsOptions.resetMocks;
39
+ delete yargsOptions.resetModules;
40
+ delete yargsOptions.restoreMocks;
41
+ delete yargsOptions.preset;
42
+ delete yargsOptions.prettierPath;
43
+ delete yargsOptions.maxWorkers;
44
+ delete yargsOptions.moduleDirectories;
45
+ delete yargsOptions.moduleFileExtensions;
46
+ delete yargsOptions.moduleNameMapper;
47
+ delete yargsOptions.modulePathIgnorePatterns;
48
+ delete yargsOptions.modulePaths;
49
+ delete yargsOptions.maxConcurrency;
50
+ delete yargsOptions.injectGlobals;
51
+ delete yargsOptions.globalSetup;
52
+ delete yargsOptions.globalTeardown;
53
+ delete yargsOptions.clearMocks;
54
+ delete yargsOptions.globals;
55
+ delete yargsOptions.haste;
56
+ delete yargsOptions.automock;
57
+ delete yargsOptions.coverageProvider;
58
+ delete yargsOptions.logHeapUsage;
59
+ };
60
+ patchYargsOptions();
61
+ checkForOldConfig().then(() => run());
package/dist/jest.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=jest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jest.d.ts","sourceRoot":"","sources":["../src/jest.ts"],"names":[],"mappings":""}
package/dist/jest.js ADDED
@@ -0,0 +1,7 @@
1
+ import { run, yargsOptions } from 'jest-cli';
2
+ yargsOptions.harnessRunner = {
3
+ type: 'string',
4
+ description: 'Specify which Harness runner to use',
5
+ requiresArg: true,
6
+ };
7
+ run();
@@ -7,5 +7,4 @@ export declare const runEmulator: (name: string) => Promise<ChildProcess>;
7
7
  export declare const stopEmulator: (avdName: string) => Promise<void>;
8
8
  export declare const isAppInstalled: (emulatorId: string, bundleId: string) => Promise<boolean>;
9
9
  export declare const reversePort: (port: number) => Promise<void>;
10
- export declare const getEmulatorScreenshot: (emulatorId: string, name?: string) => Promise<string>;
11
10
  //# sourceMappingURL=emulator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"emulator.d.ts","sourceRoot":"","sources":["../../../src/platforms/android/emulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtE,eAAO,MAAM,qBAAqB,GAChC,YAAY,MAAM,KACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAQvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,IAAI,CAmBvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,KACd,OAAO,CAAC,qBAAqB,CAc/B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,YAAY,CA2BpE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAQhE,CAAC;AAOF,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAOjB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAE5D,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAChC,YAAY,MAAM,EAClB,OAAM,MAGsB,KAC3B,OAAO,CAAC,MAAM,CAchB,CAAC"}
1
+ {"version":3,"file":"emulator.d.ts","sourceRoot":"","sources":["../../../src/platforms/android/emulator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEtE,eAAO,MAAM,qBAAqB,GAChC,YAAY,MAAM,KACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAcvB,CAAC;AAEF,eAAO,MAAM,mBAAmB,GAC9B,SAAS,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,IAAI,CAmBvB,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAC5B,SAAS,MAAM,KACd,OAAO,CAAC,qBAAqB,CAoB/B,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,YAAY,CA2BpE,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAQhE,CAAC;AAOF,eAAO,MAAM,cAAc,GACzB,YAAY,MAAM,EAClB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAejB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAE5D,CAAC"}
@@ -1,7 +1,13 @@
1
1
  import { spawn } from '@react-native-harness/tools';
2
2
  export const getEmulatorNameFromId = async (emulatorId) => {
3
3
  try {
4
- const { stdout } = await spawn('adb', ['-s', emulatorId, 'emu', 'avd', 'name']);
4
+ const { stdout } = await spawn('adb', [
5
+ '-s',
6
+ emulatorId,
7
+ 'emu',
8
+ 'avd',
9
+ 'name',
10
+ ]);
5
11
  const avdName = stdout.split('\n')[0].trim();
6
12
  return avdName || null;
7
13
  }
@@ -36,7 +42,13 @@ export const getEmulatorStatus = async (avdName) => {
36
42
  }
37
43
  try {
38
44
  // Check if device is fully booted by checking boot completion
39
- const { stdout } = await spawn('adb', ['-s', emulatorId, 'shell', 'getprop', 'sys.boot_completed']);
45
+ const { stdout } = await spawn('adb', [
46
+ '-s',
47
+ emulatorId,
48
+ 'shell',
49
+ 'getprop',
50
+ 'sys.boot_completed',
51
+ ]);
40
52
  const bootCompleted = stdout.trim() === '1';
41
53
  return bootCompleted ? 'running' : 'loading';
42
54
  }
@@ -56,17 +68,17 @@ export const runEmulator = async (name) => {
56
68
  }
57
69
  else if (status === 'loading') {
58
70
  // Check again in 2 seconds
59
- await new Promise(resolve => setTimeout(resolve, 2000));
71
+ await new Promise((resolve) => setTimeout(resolve, 2000));
60
72
  await checkStatus();
61
73
  }
62
74
  else {
63
75
  // Still stopped, check again in 1 second
64
- await new Promise(resolve => setTimeout(resolve, 1000));
76
+ await new Promise((resolve) => setTimeout(resolve, 1000));
65
77
  await checkStatus();
66
78
  }
67
79
  };
68
80
  // Start checking status after a brief delay to allow emulator to start
69
- await new Promise(resolve => setTimeout(resolve, 3000));
81
+ await new Promise((resolve) => setTimeout(resolve, 3000));
70
82
  await checkStatus();
71
83
  return nodeChildProcess;
72
84
  };
@@ -84,7 +96,15 @@ const stopEmulatorById = async (emulatorId) => {
84
96
  };
85
97
  export const isAppInstalled = async (emulatorId, bundleId) => {
86
98
  try {
87
- const { stdout } = await spawn('adb', ['-s', emulatorId, 'shell', 'pm', 'list', 'packages', bundleId]);
99
+ const { stdout } = await spawn('adb', [
100
+ '-s',
101
+ emulatorId,
102
+ 'shell',
103
+ 'pm',
104
+ 'list',
105
+ 'packages',
106
+ bundleId,
107
+ ]);
88
108
  return stdout.trim() !== '';
89
109
  }
90
110
  catch {
@@ -94,17 +114,3 @@ export const isAppInstalled = async (emulatorId, bundleId) => {
94
114
  export const reversePort = async (port) => {
95
115
  await spawn('adb', ['reverse', `tcp:${port}`, `tcp:${port}`]);
96
116
  };
97
- export const getEmulatorScreenshot = async (emulatorId, name = `${emulatorId}-${new Date()
98
- .toISOString()
99
- .replace(/:/g, '-')
100
- .replace(/\//g, '-')}.png`) => {
101
- // Use screencap to save directly to device, then pull the file
102
- const devicePath = '/sdcard/screenshot.png';
103
- // Take screenshot and save to device
104
- await spawn('adb', ['-s', emulatorId, 'shell', 'screencap', '-p', devicePath]);
105
- // Pull the file from device to local
106
- await spawn('adb', ['-s', emulatorId, 'pull', devicePath, name]);
107
- // Clean up the file on device
108
- await spawn('adb', ['-s', emulatorId, 'shell', 'rm', devicePath]);
109
- return name;
110
- };
@@ -41,7 +41,7 @@ const androidPlatformAdapter = {
41
41
  logger.debug('App running');
42
42
  return {
43
43
  restart: async () => {
44
- await runApp(runner.deviceId, runner.bundleId, runner.activityName);
44
+ await runApp(deviceId, runner.bundleId, runner.activityName);
45
45
  },
46
46
  dispose: async () => {
47
47
  await killApp(deviceId, runner.bundleId);
@@ -1 +1 @@
1
- {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/platforms/ios/build.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,GAAG,CAQ/C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,EACrB,eAAe,MAAM,KACpB,OAAO,CAAC,GAAG,GAAG,IAAI,CAqBpB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CAY7D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAGjB,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAGxE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAEzE,CAAC"}
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/platforms/ios/build.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,GAAG,CAQ/C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,EACrB,eAAe,MAAM,KAEpB,OAAO,CAAC,GAAG,GAAG,IAAI,CAsBpB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CAY7D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CAGjB,CAAC;AAEF,eAAO,MAAM,MAAM,GAAU,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAGxE,CAAC;AAEF,eAAO,MAAM,OAAO,GAAU,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,IAAI,CAEzE,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { spawn, spawnAndForget } from '@react-native-harness/tools';
2
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
3
  export const listDevices = async () => {
3
4
  const { stdout } = await spawn('xcrun', [
4
5
  'simctl',
@@ -8,7 +9,9 @@ export const listDevices = async () => {
8
9
  ]);
9
10
  return JSON.parse(stdout);
10
11
  };
11
- export const getDeviceByName = async (simulatorName, systemVersion) => {
12
+ export const getDeviceByName = async (simulatorName, systemVersion
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
14
+ ) => {
12
15
  const devices = await listDevices();
13
16
  const expectedRuntimeId = `com.apple.CoreSimulator.SimRuntime.iOS-${systemVersion.replace(/\./, '-')}`;
14
17
  const runtime = devices.devices[expectedRuntimeId];
@@ -16,6 +19,7 @@ export const getDeviceByName = async (simulatorName, systemVersion) => {
16
19
  return null;
17
20
  }
18
21
  const runtimeDevices = devices.devices[runtime];
22
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
19
23
  const device = runtimeDevices.find((d) => d.name === simulatorName);
20
24
  if (device) {
21
25
  return device;
@@ -1,7 +1,11 @@
1
- export declare const listDevices: () => Promise<any>;
2
- export declare const getDeviceByName: (simulatorName: string) => Promise<any | null>;
1
+ type Device = any;
2
+ export declare const listDevices: () => Promise<{
3
+ devices: Device[];
4
+ }>;
5
+ export declare const getDeviceByName: (simulatorName: string) => Promise<Device | null>;
3
6
  export declare const listApps: (udid: string) => Promise<string[]>;
4
7
  export declare const isAppInstalled: (simulatorName: string, bundleId: string) => Promise<boolean>;
5
8
  export declare const runApp: (simulatorName: string, appName: string) => Promise<void>;
6
9
  export declare const killApp: (simulatorName: string, appName: string) => Promise<void>;
10
+ export {};
7
11
  //# sourceMappingURL=device.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../src/platforms/ios/device.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC,GAAG,CAQ/C,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,KACpB,OAAO,CAAC,GAAG,GAAG,IAAI,CAapB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CAY7D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,eAAe,MAAM,EACrB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CASjB,CAAC;AAEF,eAAO,MAAM,MAAM,GACjB,eAAe,MAAM,EACrB,SAAS,MAAM,KACd,OAAO,CAAC,IAAI,CAGd,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,eAAe,MAAM,EACrB,SAAS,MAAM,KACd,OAAO,CAAC,IAAI,CAOd,CAAC"}
1
+ {"version":3,"file":"device.d.ts","sourceRoot":"","sources":["../../../src/platforms/ios/device.ts"],"names":[],"mappings":"AAGA,KAAK,MAAM,GAAG,GAAG,CAAC;AAElB,eAAO,MAAM,WAAW,QAAa,OAAO,CAAC;IAAE,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,CAQjE,CAAC;AAEF,eAAO,MAAM,eAAe,GAC1B,eAAe,MAAM,KACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAavB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,MAAM,EAAE,CAY7D,CAAC;AAEF,eAAO,MAAM,cAAc,GACzB,eAAe,MAAM,EACrB,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,CASjB,CAAC;AAEF,eAAO,MAAM,MAAM,GACjB,eAAe,MAAM,EACrB,SAAS,MAAM,KACd,OAAO,CAAC,IAAI,CAGd,CAAC;AAEF,eAAO,MAAM,OAAO,GAClB,eAAe,MAAM,EACrB,SAAS,MAAM,KACd,OAAO,CAAC,IAAI,CAOd,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"simulator.d.ts","sourceRoot":"","sources":["../../../src/platforms/ios/simulator.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnE,eAAO,MAAM,oBAAoB,GAC/B,eAAe,MAAM,EACrB,eAAe,MAAM,KACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CA8BvB,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAa,OAAO,CACrD,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAmCvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,KACX,OAAO,CAAC,kBAAkB,CAgC5B,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAiC7D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAE9D,CAAC"}
1
+ {"version":3,"file":"simulator.d.ts","sourceRoot":"","sources":["../../../src/platforms/ios/simulator.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CAAC;AAEnE,eAAO,MAAM,oBAAoB,GAC/B,eAAe,MAAM,EACrB,eAAe,MAAM,KACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CA+BvB,CAAC;AAEF,eAAO,MAAM,sBAAsB,QAAa,OAAO,CACrD,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAoCvD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAC7B,MAAM,MAAM,KACX,OAAO,CAAC,kBAAkB,CAiC5B,CAAC;AAEF,eAAO,MAAM,YAAY,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAkC7D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAE9D,CAAC"}
@@ -1,4 +1,4 @@
1
- import { spawn } from '@react-native-harness/tools';
1
+ import { spawn, SubprocessError } from '@react-native-harness/tools';
2
2
  export const getSimulatorDeviceId = async (simulatorName, systemVersion) => {
3
3
  try {
4
4
  const { stdout } = await spawn('xcrun', [
@@ -13,6 +13,7 @@ export const getSimulatorDeviceId = async (simulatorName, systemVersion) => {
13
13
  if (!runtime) {
14
14
  return null;
15
15
  }
16
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
17
  const device = runtime.find((d) => d.name === simulatorName);
17
18
  if (device) {
18
19
  return device.udid;
@@ -36,6 +37,7 @@ export const getAvailableSimulators = async () => {
36
37
  for (const runtime in devices.devices) {
37
38
  if (runtime.includes('iOS')) {
38
39
  const runtimeDevices = devices.devices[runtime];
40
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
41
  runtimeDevices.forEach((device) => {
40
42
  if (device.isAvailable) {
41
43
  simulators.push({
@@ -65,6 +67,7 @@ export const getSimulatorStatus = async (udid) => {
65
67
  for (const runtime in devices.devices) {
66
68
  if (runtime.includes('iOS')) {
67
69
  const runtimeDevices = devices.devices[runtime];
70
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
68
71
  const device = runtimeDevices.find((d) => d.udid === udid);
69
72
  if (device) {
70
73
  switch (device.state) {
@@ -90,7 +93,8 @@ export const runSimulator = async (udid) => {
90
93
  }
91
94
  catch (bootError) {
92
95
  // Ignore if simulator is already booted
93
- if (!bootError.stderr?.includes('Unable to boot device in current state: Booted')) {
96
+ if (bootError instanceof SubprocessError &&
97
+ !bootError.stderr?.includes('Unable to boot device in current state: Booted')) {
94
98
  throw bootError;
95
99
  }
96
100
  }
@@ -117,7 +121,8 @@ const stopSimulatorById = async (udid) => {
117
121
  }
118
122
  catch (shutdownError) {
119
123
  // Ignore if simulator is already shut down
120
- if (!shutdownError.stderr?.includes('Unable to shutdown device in current state: Shutdown')) {
124
+ if (shutdownError instanceof SubprocessError &&
125
+ !shutdownError.stderr?.includes('Unable to shutdown device in current state: Shutdown')) {
121
126
  throw shutdownError;
122
127
  }
123
128
  }
@@ -1 +1 @@
1
- {"version":3,"file":"platform-registry.d.ts","sourceRoot":"","sources":["../../src/platforms/platform-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAWxD,eAAO,MAAM,kBAAkB,GAC7B,cAAc,MAAM,KACnB,OAAO,CAAC,eAAe,CAUzB,CAAC"}
1
+ {"version":3,"file":"platform-registry.d.ts","sourceRoot":"","sources":["../../src/platforms/platform-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAaxD,eAAO,MAAM,kBAAkB,GAC7B,cAAc,MAAM,KACnB,OAAO,CAAC,eAAe,CAUzB,CAAC"}
@@ -1,10 +1,12 @@
1
1
  import androidPlatformAdapter from './android/index.js';
2
2
  import iosPlatformAdapter from './ios/index.js';
3
3
  import webPlatformAdapter from './web/index.js';
4
+ import vegaPlatformAdapter from './vega/index.js';
4
5
  const platformAdapters = {
5
6
  android: androidPlatformAdapter,
6
7
  ios: iosPlatformAdapter,
7
8
  web: webPlatformAdapter,
9
+ vega: vegaPlatformAdapter,
8
10
  };
9
11
  export const getPlatformAdapter = async (platformName) => {
10
12
  if (!(platformName in platformAdapters)) {
@@ -13,7 +15,7 @@ export const getPlatformAdapter = async (platformName) => {
13
15
  try {
14
16
  return platformAdapters[platformName];
15
17
  }
16
- catch (error) {
18
+ catch {
17
19
  throw new Error(`Platform adapter for ${platformName} not found`);
18
20
  }
19
21
  };
@@ -0,0 +1,23 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,55 @@
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
+ };
@@ -0,0 +1,57 @@
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
@@ -0,0 +1 @@
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"}