@react-native-harness/platform-android 1.4.0 → 1.4.1

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 (60) hide show
  1. package/package.json +4 -4
  2. package/dist/__tests__/adb-id.test.d.ts +0 -2
  3. package/dist/__tests__/adb-id.test.d.ts.map +0 -1
  4. package/dist/__tests__/adb-id.test.js +0 -41
  5. package/dist/__tests__/adb-wait.test.d.ts +0 -2
  6. package/dist/__tests__/adb-wait.test.d.ts.map +0 -1
  7. package/dist/__tests__/adb-wait.test.js +0 -69
  8. package/dist/__tests__/adb.test.d.ts +0 -2
  9. package/dist/__tests__/adb.test.d.ts.map +0 -1
  10. package/dist/__tests__/adb.test.js +0 -552
  11. package/dist/__tests__/app-monitor.test.d.ts +0 -2
  12. package/dist/__tests__/app-monitor.test.d.ts.map +0 -1
  13. package/dist/__tests__/app-monitor.test.js +0 -257
  14. package/dist/__tests__/app-session.test.d.ts +0 -2
  15. package/dist/__tests__/app-session.test.d.ts.map +0 -1
  16. package/dist/__tests__/app-session.test.js +0 -57
  17. package/dist/__tests__/avd-config.test.d.ts +0 -2
  18. package/dist/__tests__/avd-config.test.d.ts.map +0 -1
  19. package/dist/__tests__/avd-config.test.js +0 -232
  20. package/dist/__tests__/ci-action.test.d.ts +0 -2
  21. package/dist/__tests__/ci-action.test.d.ts.map +0 -1
  22. package/dist/__tests__/ci-action.test.js +0 -46
  23. package/dist/__tests__/crash-diagnostics.test.d.ts +0 -2
  24. package/dist/__tests__/crash-diagnostics.test.d.ts.map +0 -1
  25. package/dist/__tests__/crash-diagnostics.test.js +0 -119
  26. package/dist/__tests__/crash-parser.test.d.ts +0 -2
  27. package/dist/__tests__/crash-parser.test.d.ts.map +0 -1
  28. package/dist/__tests__/crash-parser.test.js +0 -45
  29. package/dist/__tests__/crash-reporter.test.d.ts +0 -2
  30. package/dist/__tests__/crash-reporter.test.d.ts.map +0 -1
  31. package/dist/__tests__/crash-reporter.test.js +0 -150
  32. package/dist/__tests__/emulator-startup.test.d.ts +0 -2
  33. package/dist/__tests__/emulator-startup.test.d.ts.map +0 -1
  34. package/dist/__tests__/emulator-startup.test.js +0 -47
  35. package/dist/__tests__/environment.test.d.ts +0 -2
  36. package/dist/__tests__/environment.test.d.ts.map +0 -1
  37. package/dist/__tests__/environment.test.js +0 -117
  38. package/dist/__tests__/instance.test.d.ts +0 -2
  39. package/dist/__tests__/instance.test.d.ts.map +0 -1
  40. package/dist/__tests__/instance.test.js +0 -599
  41. package/dist/__tests__/shared-prefs.test.d.ts +0 -2
  42. package/dist/__tests__/shared-prefs.test.d.ts.map +0 -1
  43. package/dist/__tests__/shared-prefs.test.js +0 -87
  44. package/dist/__tests__/targets.test.d.ts +0 -2
  45. package/dist/__tests__/targets.test.d.ts.map +0 -1
  46. package/dist/__tests__/targets.test.js +0 -49
  47. package/dist/tsconfig.lib.tsbuildinfo +0 -1
  48. package/src/__tests__/adb-id.test.ts +0 -51
  49. package/src/__tests__/adb-wait.test.ts +0 -95
  50. package/src/__tests__/app-session.test.ts +0 -76
  51. package/src/__tests__/avd-config.test.ts +0 -276
  52. package/src/__tests__/ci-action.test.ts +0 -81
  53. package/src/__tests__/crash-diagnostics.test.ts +0 -144
  54. package/src/__tests__/crash-parser.test.ts +0 -52
  55. package/src/__tests__/crash-reporter.test.ts +0 -167
  56. package/src/__tests__/emulator-startup.test.ts +0 -82
  57. package/src/__tests__/instance.test.ts +0 -844
  58. package/src/__tests__/shared-prefs.test.ts +0 -144
  59. package/src/__tests__/targets.test.ts +0 -53
  60. package/tsconfig.tsbuildinfo +0 -1
@@ -1,167 +0,0 @@
1
- import { afterEach, describe, expect, it, vi } from 'vitest';
2
- import { createAndroidCrashReporter } from '../crash-reporter.js';
3
-
4
- const javaCrashDropbox = `
5
- ========================================
6
- 2026-03-12 10:30:45.123 data_app_crash (text, 500 bytes)
7
- Process: com.harnessplayground
8
- PID: 7777
9
- Package: com.harnessplayground v1 (1.0)
10
- java.lang.RuntimeException: boom
11
- \tat com.harnessplayground.MainActivity.onCreate(MainActivity.kt:38)
12
- `;
13
-
14
- const nativeCrashDropbox = `
15
- ========================================
16
- 2026-03-12 10:31:10.456 data_app_native_crash (text, 800 bytes)
17
- Process: com.harnessplayground
18
- PID: 8888
19
- signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadbeef
20
- Abort message: 'JNI DETECTED ERROR IN APPLICATION'
21
- backtrace:
22
- #00 pc 00001234 /data/app/lib/libapp.so
23
- `;
24
-
25
- describe('createAndroidCrashReporter', () => {
26
- afterEach(() => {
27
- vi.useRealTimers();
28
- });
29
-
30
- it('persists the current logcat crash block with the test file path', async () => {
31
- vi.useFakeTimers();
32
- const persistArtifact = vi.fn(
33
- () => '/tmp/.harness/crash-reports/logcat.txt'
34
- );
35
- const reporter = createAndroidCrashReporter({
36
- bundleId: 'com.harnessplayground',
37
- crashArtifactWriter: {
38
- runTimestamp: '2026-03-12T11-35-08-000Z',
39
- persistArtifact,
40
- },
41
- getLogs: () => [
42
- { line: 'ordinary crash-buffer line', occurredAt: 1_000 },
43
- { line: '--------- beginning of crash', occurredAt: 1_100 },
44
- {
45
- line: 'Process: com.harnessplayground, PID: 7777',
46
- occurredAt: 1_100,
47
- },
48
- { line: 'FATAL EXCEPTION: main', occurredAt: 1_100 },
49
- ],
50
- });
51
-
52
- const detailsPromise = reporter.getCrashDetails({
53
- occurredAt: 1_100,
54
- pid: 7777,
55
- testFilePath: '/test/native-crash.test.ts',
56
- });
57
- await vi.advanceTimersByTimeAsync(100);
58
- const details = await detailsPromise;
59
-
60
- expect(details).toMatchObject({
61
- artifactType: 'logcat',
62
- artifactPath: '/tmp/.harness/crash-reports/logcat.txt',
63
- pid: 7777,
64
- processName: 'com.harnessplayground',
65
- });
66
- expect(persistArtifact).toHaveBeenCalledWith({
67
- artifactKind: 'logcat',
68
- testFilePath: '/test/native-crash.test.ts',
69
- source: {
70
- kind: 'text',
71
- fileName: 'logcat.txt',
72
- text: [
73
- '--------- beginning of crash',
74
- 'Process: com.harnessplayground, PID: 7777',
75
- 'FATAL EXCEPTION: main',
76
- '',
77
- ].join('\n'),
78
- },
79
- });
80
- });
81
-
82
- it('adds dropbox artifacts as enrichment when logcat evidence is available', async () => {
83
- vi.useFakeTimers();
84
- const persistArtifact = vi
85
- .fn()
86
- .mockImplementation(({ artifactKind }: { artifactKind: string }) => {
87
- return `/tmp/.harness/crash-reports/${artifactKind}.txt`;
88
- });
89
- const reporter = createAndroidCrashReporter({
90
- bundleId: 'com.harnessplayground',
91
- crashArtifactWriter: {
92
- runTimestamp: '2026-03-12T11-35-08-000Z',
93
- persistArtifact,
94
- },
95
- getLogs: () => [
96
- { line: '--------- beginning of crash', occurredAt: 1_100 },
97
- {
98
- line: 'Process: com.harnessplayground, PID: 7777',
99
- occurredAt: 1_100,
100
- },
101
- { line: 'FATAL EXCEPTION: main', occurredAt: 1_100 },
102
- ],
103
- getDropboxOutput: async () => javaCrashDropbox,
104
- getExitInfo: async () =>
105
- 'ApplicationExitInfo #0:\n package=com.harnessplayground pid=7777 reason=4 (APP CRASH(NATIVE))',
106
- });
107
-
108
- const detailsPromise = reporter.getCrashDetails({
109
- occurredAt: 1_100,
110
- pid: 7777,
111
- testFilePath: '/test/native-crash.test.ts',
112
- });
113
- await vi.advanceTimersByTimeAsync(100);
114
- const details = await detailsPromise;
115
-
116
- expect(details).toMatchObject({
117
- artifactType: 'logcat',
118
- artifactPath: '/tmp/.harness/crash-reports/logcat.txt',
119
- });
120
- expect(details?.enrichmentArtifacts).toEqual(
121
- expect.arrayContaining([
122
- {
123
- artifactType: 'dropbox-crash',
124
- artifactPath: '/tmp/.harness/crash-reports/dropbox-crash.txt',
125
- },
126
- {
127
- artifactType: 'exit-info',
128
- artifactPath: '/tmp/.harness/crash-reports/exit-info.txt',
129
- },
130
- ])
131
- );
132
- });
133
-
134
- it('falls back to native dropbox evidence when logcat is empty', async () => {
135
- vi.useFakeTimers();
136
- const persistArtifact = vi
137
- .fn()
138
- .mockImplementation(({ artifactKind }: { artifactKind: string }) => {
139
- return `/tmp/.harness/crash-reports/${artifactKind}.txt`;
140
- });
141
- const reporter = createAndroidCrashReporter({
142
- bundleId: 'com.harnessplayground',
143
- crashArtifactWriter: {
144
- runTimestamp: '2026-03-12T11-35-08-000Z',
145
- persistArtifact,
146
- },
147
- getLogs: () => [],
148
- getDropboxOutput: async () => nativeCrashDropbox,
149
- });
150
-
151
- const detailsPromise = reporter.getCrashDetails({
152
- occurredAt: 1_100,
153
- pid: 8888,
154
- testFilePath: '/test/native-crash.test.ts',
155
- });
156
- await vi.advanceTimersByTimeAsync(100);
157
- const details = await detailsPromise;
158
-
159
- expect(details).toMatchObject({
160
- artifactType: 'dropbox-native-crash',
161
- artifactPath: '/tmp/.harness/crash-reports/dropbox-native-crash.txt',
162
- pid: 8888,
163
- signal: 'SIGSEGV',
164
- processName: 'com.harnessplayground',
165
- });
166
- });
167
- });
@@ -1,82 +0,0 @@
1
- import { describe, expect, it } from 'vitest';
2
- import {
3
- getEmulatorCpuCores,
4
- getEmulatorStartupArgs,
5
- isAccelerationUsable,
6
- } from '../emulator-startup.js';
7
- import { getDeviceCoreBudget } from '@react-native-harness/tools';
8
- import os from 'node:os';
9
-
10
- describe('getEmulatorCpuCores', () => {
11
- it('uses the shared device-core budget for the current host', () => {
12
- expect(getEmulatorCpuCores()).toBe(
13
- getDeviceCoreBudget(os.availableParallelism())
14
- );
15
- });
16
- });
17
-
18
- describe('emulator startup modes', () => {
19
- it('builds default boot args', () => {
20
- expect(getEmulatorStartupArgs('Pixel_8_API_35', 'default-boot')).toEqual(
21
- expect.arrayContaining([
22
- '@Pixel_8_API_35',
23
- '-no-snapshot-load',
24
- '-no-snapshot-save',
25
- '-no-metrics',
26
- ])
27
- );
28
- expect(
29
- getEmulatorStartupArgs('Pixel_8_API_35', 'default-boot')
30
- ).not.toEqual(expect.arrayContaining(['-camera-back', 'none']));
31
- });
32
-
33
- it('builds clean snapshot generation args', () => {
34
- expect(
35
- getEmulatorStartupArgs('Pixel_8_API_35', 'clean-snapshot-generation')
36
- ).toEqual(
37
- expect.arrayContaining([
38
- '@Pixel_8_API_35',
39
- '-no-snapshot-load',
40
- '-no-metrics',
41
- ])
42
- );
43
- expect(
44
- getEmulatorStartupArgs('Pixel_8_API_35', 'clean-snapshot-generation')
45
- ).not.toContain('-no-snapshot-save');
46
- });
47
-
48
- it('builds snapshot reuse args', () => {
49
- expect(getEmulatorStartupArgs('Pixel_8_API_35', 'snapshot-reuse')).toEqual(
50
- expect.arrayContaining([
51
- '@Pixel_8_API_35',
52
- '-no-snapshot-save',
53
- '-no-metrics',
54
- ])
55
- );
56
- expect(
57
- getEmulatorStartupArgs('Pixel_8_API_35', 'snapshot-reuse')
58
- ).not.toContain('-no-snapshot-load');
59
- });
60
- });
61
-
62
- describe('isAccelerationUsable', () => {
63
- it('returns true when the emulator reports acceleration is usable', () => {
64
- expect(
65
- isAccelerationUsable(
66
- 'accel:\n0\nKVM (version 12) is installed and usable.\naccel\n'
67
- )
68
- ).toBe(true);
69
- });
70
-
71
- it('returns false when acceleration is disabled', () => {
72
- expect(
73
- isAccelerationUsable(
74
- 'accel:\n0\nKVM is not installed on this machine.\naccel\n'
75
- )
76
- ).toBe(false);
77
- });
78
-
79
- it('returns false for empty output', () => {
80
- expect(isAccelerationUsable('')).toBe(false);
81
- });
82
- });