@react-native-harness/platform-android 1.4.0-rc.1 → 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.
- package/dist/adb.d.ts +3 -1
- package/dist/adb.d.ts.map +1 -1
- package/dist/adb.js +30 -21
- package/dist/app-session.d.ts +11 -2
- package/dist/app-session.d.ts.map +1 -1
- package/dist/app-session.js +17 -12
- package/dist/avd-config.d.ts +1 -0
- package/dist/avd-config.d.ts.map +1 -1
- package/dist/avd-config.js +11 -0
- package/dist/emulator-startup.d.ts +23 -0
- package/dist/emulator-startup.d.ts.map +1 -1
- package/dist/emulator-startup.js +58 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/instance.d.ts.map +1 -1
- package/dist/instance.js +21 -15
- package/dist/runner.d.ts +2 -2
- package/dist/runner.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/adb.ts +72 -65
- package/src/app-session.ts +28 -12
- package/src/avd-config.ts +17 -0
- package/src/emulator-startup.ts +74 -0
- package/src/index.ts +1 -0
- package/src/instance.ts +30 -16
- package/src/runner.ts +5 -9
- package/dist/__tests__/adb-id.test.d.ts +0 -2
- package/dist/__tests__/adb-id.test.d.ts.map +0 -1
- package/dist/__tests__/adb-id.test.js +0 -41
- package/dist/__tests__/adb.test.d.ts +0 -2
- package/dist/__tests__/adb.test.d.ts.map +0 -1
- package/dist/__tests__/adb.test.js +0 -552
- package/dist/__tests__/app-monitor.test.d.ts +0 -2
- package/dist/__tests__/app-monitor.test.d.ts.map +0 -1
- package/dist/__tests__/app-monitor.test.js +0 -257
- package/dist/__tests__/avd-config.test.d.ts +0 -2
- package/dist/__tests__/avd-config.test.d.ts.map +0 -1
- package/dist/__tests__/avd-config.test.js +0 -174
- package/dist/__tests__/ci-action.test.d.ts +0 -2
- package/dist/__tests__/ci-action.test.d.ts.map +0 -1
- package/dist/__tests__/ci-action.test.js +0 -46
- package/dist/__tests__/crash-diagnostics.test.d.ts +0 -2
- package/dist/__tests__/crash-diagnostics.test.d.ts.map +0 -1
- package/dist/__tests__/crash-diagnostics.test.js +0 -119
- package/dist/__tests__/crash-parser.test.d.ts +0 -2
- package/dist/__tests__/crash-parser.test.d.ts.map +0 -1
- package/dist/__tests__/crash-parser.test.js +0 -45
- package/dist/__tests__/crash-reporter.test.d.ts +0 -2
- package/dist/__tests__/crash-reporter.test.d.ts.map +0 -1
- package/dist/__tests__/crash-reporter.test.js +0 -150
- package/dist/__tests__/emulator-startup.test.d.ts +0 -2
- package/dist/__tests__/emulator-startup.test.d.ts.map +0 -1
- package/dist/__tests__/emulator-startup.test.js +0 -20
- package/dist/__tests__/environment.test.d.ts +0 -2
- package/dist/__tests__/environment.test.d.ts.map +0 -1
- package/dist/__tests__/environment.test.js +0 -117
- package/dist/__tests__/instance.test.d.ts +0 -2
- package/dist/__tests__/instance.test.d.ts.map +0 -1
- package/dist/__tests__/instance.test.js +0 -593
- package/dist/__tests__/shared-prefs.test.d.ts +0 -2
- package/dist/__tests__/shared-prefs.test.d.ts.map +0 -1
- package/dist/__tests__/shared-prefs.test.js +0 -87
- package/dist/__tests__/targets.test.d.ts +0 -2
- package/dist/__tests__/targets.test.d.ts.map +0 -1
- package/dist/__tests__/targets.test.js +0 -49
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/src/__tests__/adb-id.test.ts +0 -51
- package/src/__tests__/avd-config.test.ts +0 -206
- package/src/__tests__/ci-action.test.ts +0 -81
- package/src/__tests__/crash-diagnostics.test.ts +0 -144
- package/src/__tests__/crash-parser.test.ts +0 -52
- package/src/__tests__/crash-reporter.test.ts +0 -167
- package/src/__tests__/emulator-startup.test.ts +0 -35
- package/src/__tests__/instance.test.ts +0 -845
- package/src/__tests__/shared-prefs.test.ts +0 -144
- package/src/__tests__/targets.test.ts +0 -53
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { readFile } from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { describe, expect, it } from 'vitest';
|
|
4
|
-
|
|
5
|
-
const workspaceRoot = path.resolve(import.meta.dirname, '../../../..');
|
|
6
|
-
|
|
7
|
-
describe('Android GitHub action config', () => {
|
|
8
|
-
it('does not duplicate Android SDK verification in the action YAML', async () => {
|
|
9
|
-
const [rootAction, packageAction] = await Promise.all([
|
|
10
|
-
readFile(path.join(workspaceRoot, 'action.yml'), 'utf8'),
|
|
11
|
-
readFile(
|
|
12
|
-
path.join(workspaceRoot, 'packages/github-action/src/action.yml'),
|
|
13
|
-
'utf8'
|
|
14
|
-
),
|
|
15
|
-
]);
|
|
16
|
-
|
|
17
|
-
for (const actionYaml of [rootAction, packageAction]) {
|
|
18
|
-
expect(actionYaml).not.toContain('Verify Android SDK packages');
|
|
19
|
-
expect(actionYaml).toContain(
|
|
20
|
-
"steps.avd-cache.outputs.cache-hit != 'true'"
|
|
21
|
-
);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
it('removes the third-party emulator runner and maps cacheAvd to HARNESS_AVD_CACHING', async () => {
|
|
26
|
-
const [rootAction, packageAction] = await Promise.all([
|
|
27
|
-
readFile(path.join(workspaceRoot, 'action.yml'), 'utf8'),
|
|
28
|
-
readFile(
|
|
29
|
-
path.join(workspaceRoot, 'packages/github-action/src/action.yml'),
|
|
30
|
-
'utf8'
|
|
31
|
-
),
|
|
32
|
-
]);
|
|
33
|
-
|
|
34
|
-
for (const actionYaml of [rootAction, packageAction]) {
|
|
35
|
-
expect(actionYaml).not.toContain(
|
|
36
|
-
'reactivecircus/android-emulator-runner'
|
|
37
|
-
);
|
|
38
|
-
expect(actionYaml).toContain(
|
|
39
|
-
'HARNESS_AVD_CACHING: ${{ inputs.cacheAvd }}'
|
|
40
|
-
);
|
|
41
|
-
expect(actionYaml).toContain(
|
|
42
|
-
'fromJson(steps.load-config.outputs.config).action.avdCachingEnabled'
|
|
43
|
-
);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
it('saves the AVD cache after the Harness run step', async () => {
|
|
48
|
-
const [rootAction, packageAction] = await Promise.all([
|
|
49
|
-
readFile(path.join(workspaceRoot, 'action.yml'), 'utf8'),
|
|
50
|
-
readFile(
|
|
51
|
-
path.join(workspaceRoot, 'packages/github-action/src/action.yml'),
|
|
52
|
-
'utf8'
|
|
53
|
-
),
|
|
54
|
-
]);
|
|
55
|
-
|
|
56
|
-
for (const actionYaml of [rootAction, packageAction]) {
|
|
57
|
-
expect(actionYaml.indexOf('- name: Run E2E tests')).toBeLessThan(
|
|
58
|
-
actionYaml.indexOf('- name: Save AVD cache')
|
|
59
|
-
);
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('uses a cache key that includes the emulator name', async () => {
|
|
64
|
-
const [rootAction, packageAction] = await Promise.all([
|
|
65
|
-
readFile(path.join(workspaceRoot, 'action.yml'), 'utf8'),
|
|
66
|
-
readFile(
|
|
67
|
-
path.join(workspaceRoot, 'packages/github-action/src/action.yml'),
|
|
68
|
-
'utf8'
|
|
69
|
-
),
|
|
70
|
-
]);
|
|
71
|
-
|
|
72
|
-
for (const actionYaml of [rootAction, packageAction]) {
|
|
73
|
-
expect(actionYaml).toContain(
|
|
74
|
-
"AVD_NAME='${{ fromJson(steps.load-config.outputs.config).config.device.name }}'"
|
|
75
|
-
);
|
|
76
|
-
expect(actionYaml).toContain(
|
|
77
|
-
'CACHE_KEY="avd-$AVD_NAME-$ARCH-$AVD_CONFIG_HASH"'
|
|
78
|
-
);
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
});
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
collectDropboxArtifacts,
|
|
4
|
-
filterExitInfo,
|
|
5
|
-
getBestDropboxArtifact,
|
|
6
|
-
parseDropboxOutput,
|
|
7
|
-
} from '../crash-diagnostics.js';
|
|
8
|
-
|
|
9
|
-
const javaCrashDropbox = `
|
|
10
|
-
Drop box contents: 1 entries
|
|
11
|
-
Max entries: 1000
|
|
12
|
-
========================================
|
|
13
|
-
2026-03-12 10:30:45.123 data_app_crash (text, 500 bytes)
|
|
14
|
-
Process: com.harnessplayground
|
|
15
|
-
PID: 7777
|
|
16
|
-
Package: com.harnessplayground v1 (1.0)
|
|
17
|
-
java.lang.RuntimeException: boom
|
|
18
|
-
\tat com.harnessplayground.MainActivity.onCreate(MainActivity.kt:38)
|
|
19
|
-
`;
|
|
20
|
-
|
|
21
|
-
const nativeCrashDropbox = `
|
|
22
|
-
========================================
|
|
23
|
-
2026-03-12 10:31:10.456 data_app_native_crash (text, 800 bytes)
|
|
24
|
-
Process: com.harnessplayground
|
|
25
|
-
PID: 8888
|
|
26
|
-
signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0xdeadbeef
|
|
27
|
-
Abort message: 'JNI DETECTED ERROR IN APPLICATION'
|
|
28
|
-
backtrace:
|
|
29
|
-
#00 pc 00001234 /data/app/lib/libapp.so
|
|
30
|
-
`;
|
|
31
|
-
|
|
32
|
-
const deviceJavaCrashDropbox = `
|
|
33
|
-
Drop box contents: 8 entries
|
|
34
|
-
Searching for: data_app_crash
|
|
35
|
-
|
|
36
|
-
========================================
|
|
37
|
-
2026-05-29 10:22:34 data_app_crash (text, 1328 bytes)
|
|
38
|
-
SystemUptimeMs: 79467172
|
|
39
|
-
Process: com.harnessplayground
|
|
40
|
-
PID: 586
|
|
41
|
-
Package: com.harnessplayground v1 (1.0)
|
|
42
|
-
java.lang.RuntimeException: Intentional asynchronous Kotlin crash
|
|
43
|
-
\tat com.harnessplayground.PlaygroundCrashModule.crashFromKotlinAsync(PlaygroundCrashModule.kt:44)
|
|
44
|
-
`;
|
|
45
|
-
|
|
46
|
-
describe('collectDropboxArtifacts', () => {
|
|
47
|
-
it('matches harness playground crashes from merged per-tag dropbox output', async () => {
|
|
48
|
-
const artifacts = await collectDropboxArtifacts({
|
|
49
|
-
bundleId: 'com.harnessplayground',
|
|
50
|
-
getDropboxOutput: async () => deviceJavaCrashDropbox,
|
|
51
|
-
occurredAt: Date.now(),
|
|
52
|
-
pid: 586,
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
expect(artifacts).toHaveLength(1);
|
|
56
|
-
expect(artifacts[0]).toMatchObject({
|
|
57
|
-
artifactType: 'dropbox-crash',
|
|
58
|
-
pid: 586,
|
|
59
|
-
processName: 'com.harnessplayground',
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('ignores Dropbox entries older than the session start time', async () => {
|
|
64
|
-
const artifacts = await collectDropboxArtifacts({
|
|
65
|
-
bundleId: 'com.harnessplayground',
|
|
66
|
-
getDropboxOutput: async () => deviceJavaCrashDropbox,
|
|
67
|
-
minOccurredAt: Date.parse('2026-05-29T10:22:35.000Z'),
|
|
68
|
-
occurredAt: Date.parse('2026-05-29T10:22:36.000Z'),
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
expect(artifacts).toHaveLength(0);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
describe('parseDropboxOutput', () => {
|
|
76
|
-
it('parses java and native dropbox entries', () => {
|
|
77
|
-
const entries = parseDropboxOutput(`${javaCrashDropbox}\n${nativeCrashDropbox}`);
|
|
78
|
-
|
|
79
|
-
expect(entries).toHaveLength(2);
|
|
80
|
-
expect(entries[0]).toMatchObject({
|
|
81
|
-
tag: 'data_app_crash',
|
|
82
|
-
pid: 7777,
|
|
83
|
-
});
|
|
84
|
-
expect(entries[1]).toMatchObject({
|
|
85
|
-
tag: 'data_app_native_crash',
|
|
86
|
-
pid: 8888,
|
|
87
|
-
});
|
|
88
|
-
expect(entries[1]?.content).toContain('SIGSEGV');
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
describe('getBestDropboxArtifact', () => {
|
|
93
|
-
it('prefers the highest-scored artifact', () => {
|
|
94
|
-
const entries = parseDropboxOutput(`${javaCrashDropbox}\n${nativeCrashDropbox}`);
|
|
95
|
-
const artifacts = entries.map((entry, index) => ({
|
|
96
|
-
artifactType:
|
|
97
|
-
entry.tag === 'data_app_native_crash'
|
|
98
|
-
? ('dropbox-native-crash' as const)
|
|
99
|
-
: ('dropbox-crash' as const),
|
|
100
|
-
dropboxTag: entry.tag,
|
|
101
|
-
occurredAt: Date.now(),
|
|
102
|
-
score: index === 0 ? 100 : 300,
|
|
103
|
-
summary: entry.content,
|
|
104
|
-
pid: entry.pid,
|
|
105
|
-
processName: 'com.harnessplayground',
|
|
106
|
-
}));
|
|
107
|
-
|
|
108
|
-
expect(getBestDropboxArtifact(artifacts)?.dropboxTag).toBe(
|
|
109
|
-
'data_app_native_crash'
|
|
110
|
-
);
|
|
111
|
-
});
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
describe('filterExitInfo', () => {
|
|
115
|
-
it('returns matching exit-info records for the target package and pid', () => {
|
|
116
|
-
const output = `
|
|
117
|
-
ApplicationExitInfo #0:
|
|
118
|
-
package=com.harnessplayground pid=7777 realUid=10123
|
|
119
|
-
reason=4 (APP CRASH(NATIVE))
|
|
120
|
-
timestamp=2026-03-12 10:31:10.456
|
|
121
|
-
ApplicationExitInfo #1:
|
|
122
|
-
package=com.other.app pid=9999 realUid=10199
|
|
123
|
-
reason=10 (USER REQUESTED)
|
|
124
|
-
`;
|
|
125
|
-
|
|
126
|
-
const filtered = filterExitInfo({
|
|
127
|
-
output,
|
|
128
|
-
bundleId: 'com.harnessplayground',
|
|
129
|
-
pid: 7777,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
expect(filtered).toContain('com.harnessplayground pid=7777');
|
|
133
|
-
expect(filtered).not.toContain('com.other.app');
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
it('returns null when no exit-info records exist', () => {
|
|
137
|
-
expect(
|
|
138
|
-
filterExitInfo({
|
|
139
|
-
output: 'No exit info records for com.harnessplayground',
|
|
140
|
-
bundleId: 'com.harnessplayground',
|
|
141
|
-
})
|
|
142
|
-
).toBeNull();
|
|
143
|
-
});
|
|
144
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { androidCrashParser } from '../crash-parser.js';
|
|
3
|
-
|
|
4
|
-
describe('androidCrashParser.parse', () => {
|
|
5
|
-
it('parses an AndroidRuntime crash block into a crash details object', () => {
|
|
6
|
-
expect(
|
|
7
|
-
androidCrashParser.parse({
|
|
8
|
-
contents: [
|
|
9
|
-
'--------- beginning of crash',
|
|
10
|
-
'03-12 11:35:09.000 1234 1234 E AndroidRuntime: Process: com.harnessplayground, PID: 1234',
|
|
11
|
-
'03-12 11:35:09.001 1234 1234 E AndroidRuntime: java.lang.RuntimeException: boom',
|
|
12
|
-
'03-12 11:35:09.002 1234 1234 E AndroidRuntime: at com.harnessplayground.MainActivity.onCreate(MainActivity.kt:42)',
|
|
13
|
-
].join('\n'),
|
|
14
|
-
bundleId: 'com.harnessplayground',
|
|
15
|
-
})
|
|
16
|
-
).toEqual({
|
|
17
|
-
source: 'logs',
|
|
18
|
-
summary: [
|
|
19
|
-
'--------- beginning of crash',
|
|
20
|
-
'03-12 11:35:09.000 1234 1234 E AndroidRuntime: Process: com.harnessplayground, PID: 1234',
|
|
21
|
-
'03-12 11:35:09.001 1234 1234 E AndroidRuntime: java.lang.RuntimeException: boom',
|
|
22
|
-
'03-12 11:35:09.002 1234 1234 E AndroidRuntime: at com.harnessplayground.MainActivity.onCreate(MainActivity.kt:42)',
|
|
23
|
-
].join('\n'),
|
|
24
|
-
signal: undefined,
|
|
25
|
-
exceptionType: 'java.lang.RuntimeException: boom',
|
|
26
|
-
processName: 'com.harnessplayground',
|
|
27
|
-
pid: 1234,
|
|
28
|
-
rawLines: [
|
|
29
|
-
'--------- beginning of crash',
|
|
30
|
-
'03-12 11:35:09.000 1234 1234 E AndroidRuntime: Process: com.harnessplayground, PID: 1234',
|
|
31
|
-
'03-12 11:35:09.001 1234 1234 E AndroidRuntime: java.lang.RuntimeException: boom',
|
|
32
|
-
'03-12 11:35:09.002 1234 1234 E AndroidRuntime: at com.harnessplayground.MainActivity.onCreate(MainActivity.kt:42)',
|
|
33
|
-
],
|
|
34
|
-
stackTrace: [
|
|
35
|
-
'03-12 11:35:09.002 1234 1234 E AndroidRuntime: at com.harnessplayground.MainActivity.onCreate(MainActivity.kt:42)',
|
|
36
|
-
],
|
|
37
|
-
});
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
it('extracts fatal signals from a native crash block', () => {
|
|
41
|
-
expect(
|
|
42
|
-
androidCrashParser.parse({
|
|
43
|
-
contents:
|
|
44
|
-
'03-12 11:35:08.000 1234 1234 F libc : Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR) in tid 1234 (com.harnessplayground), pid 1234 (com.harnessplayground)',
|
|
45
|
-
bundleId: 'com.harnessplayground',
|
|
46
|
-
})
|
|
47
|
-
).toMatchObject({
|
|
48
|
-
signal: 'SIGSEGV',
|
|
49
|
-
processName: 'com.harnessplayground',
|
|
50
|
-
});
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -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,35 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import { getEmulatorStartupArgs } from '../emulator-startup.js';
|
|
3
|
-
|
|
4
|
-
describe('emulator startup modes', () => {
|
|
5
|
-
it('builds default boot args', () => {
|
|
6
|
-
expect(getEmulatorStartupArgs('Pixel_8_API_35', 'default-boot')).toEqual(
|
|
7
|
-
expect.arrayContaining([
|
|
8
|
-
'@Pixel_8_API_35',
|
|
9
|
-
'-no-snapshot-load',
|
|
10
|
-
'-no-snapshot-save',
|
|
11
|
-
])
|
|
12
|
-
);
|
|
13
|
-
expect(getEmulatorStartupArgs('Pixel_8_API_35', 'default-boot')).not.toEqual(
|
|
14
|
-
expect.arrayContaining(['-camera-back', 'none'])
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('builds clean snapshot generation args', () => {
|
|
19
|
-
expect(
|
|
20
|
-
getEmulatorStartupArgs('Pixel_8_API_35', 'clean-snapshot-generation')
|
|
21
|
-
).toEqual(expect.arrayContaining(['@Pixel_8_API_35', '-no-snapshot-load']));
|
|
22
|
-
expect(
|
|
23
|
-
getEmulatorStartupArgs('Pixel_8_API_35', 'clean-snapshot-generation')
|
|
24
|
-
).not.toContain('-no-snapshot-save');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
it('builds snapshot reuse args', () => {
|
|
28
|
-
expect(getEmulatorStartupArgs('Pixel_8_API_35', 'snapshot-reuse')).toEqual(
|
|
29
|
-
expect.arrayContaining(['@Pixel_8_API_35', '-no-snapshot-save'])
|
|
30
|
-
);
|
|
31
|
-
expect(
|
|
32
|
-
getEmulatorStartupArgs('Pixel_8_API_35', 'snapshot-reuse')
|
|
33
|
-
).not.toContain('-no-snapshot-load');
|
|
34
|
-
});
|
|
35
|
-
});
|