@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.
- package/package.json +4 -4
- 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-wait.test.d.ts +0 -2
- package/dist/__tests__/adb-wait.test.d.ts.map +0 -1
- package/dist/__tests__/adb-wait.test.js +0 -69
- 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__/app-session.test.d.ts +0 -2
- package/dist/__tests__/app-session.test.d.ts.map +0 -1
- package/dist/__tests__/app-session.test.js +0 -57
- 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 -232
- 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 -47
- 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 -599
- 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__/adb-wait.test.ts +0 -95
- package/src/__tests__/app-session.test.ts +0 -76
- package/src/__tests__/avd-config.test.ts +0 -276
- 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 -82
- package/src/__tests__/instance.test.ts +0 -844
- package/src/__tests__/shared-prefs.test.ts +0 -144
- package/src/__tests__/targets.test.ts +0 -53
- package/tsconfig.tsbuildinfo +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-harness/platform-android",
|
|
3
3
|
"description": "Android platform for React Native Harness",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.1",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"module": "./dist/index.js",
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"vite": "^7.2.2",
|
|
20
20
|
"zod": "^3.25.67",
|
|
21
21
|
"tslib": "^2.3.0",
|
|
22
|
-
"@react-native-harness/config": "1.4.
|
|
23
|
-
"@react-native-harness/
|
|
24
|
-
"@react-native-harness/
|
|
22
|
+
"@react-native-harness/config": "1.4.1",
|
|
23
|
+
"@react-native-harness/platforms": "1.4.1",
|
|
24
|
+
"@react-native-harness/tools": "1.4.1"
|
|
25
25
|
},
|
|
26
26
|
"license": "MIT"
|
|
27
27
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adb-id.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/adb-id.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
import { getAdbId, isAdbIdEmulator } from '../adb-id.js';
|
|
3
|
-
import * as adb from '../adb.js';
|
|
4
|
-
describe('adb id resolution', () => {
|
|
5
|
-
beforeEach(() => {
|
|
6
|
-
vi.restoreAllMocks();
|
|
7
|
-
});
|
|
8
|
-
it('identifies emulator adb ids', () => {
|
|
9
|
-
expect(isAdbIdEmulator('emulator-5554')).toBe(true);
|
|
10
|
-
expect(isAdbIdEmulator('device-serial-001')).toBe(false);
|
|
11
|
-
});
|
|
12
|
-
it('skips non-emulator ids when resolving an emulator device', async () => {
|
|
13
|
-
vi.spyOn(adb, 'getDeviceIds').mockResolvedValue([
|
|
14
|
-
'device-serial-001',
|
|
15
|
-
'emulator-5554',
|
|
16
|
-
]);
|
|
17
|
-
vi.spyOn(adb, 'getEmulatorName').mockResolvedValue('Test_AVD_API_35');
|
|
18
|
-
await expect(getAdbId({
|
|
19
|
-
type: 'emulator',
|
|
20
|
-
name: 'Test_AVD_API_35',
|
|
21
|
-
})).resolves.toBe('emulator-5554');
|
|
22
|
-
});
|
|
23
|
-
it('resolves matching physical device by manufacturer and model', async () => {
|
|
24
|
-
vi.spyOn(adb, 'getDeviceIds').mockResolvedValue([
|
|
25
|
-
'device-serial-001',
|
|
26
|
-
'emulator-5554',
|
|
27
|
-
]);
|
|
28
|
-
vi.spyOn(adb, 'getDeviceInfo').mockImplementation(async (adbId) => {
|
|
29
|
-
const results = {
|
|
30
|
-
'device-serial-001': { manufacturer: 'Acme', model: 'Model A1' },
|
|
31
|
-
'emulator-5554': { manufacturer: 'Emulator', model: 'Emulator Model' },
|
|
32
|
-
};
|
|
33
|
-
return results[adbId] || null;
|
|
34
|
-
});
|
|
35
|
-
await expect(getAdbId({
|
|
36
|
-
type: 'physical',
|
|
37
|
-
manufacturer: 'acme',
|
|
38
|
-
model: 'model a1',
|
|
39
|
-
})).resolves.toBe('device-serial-001');
|
|
40
|
-
});
|
|
41
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adb-wait.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/adb-wait.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
-
const mocks = vi.hoisted(() => ({
|
|
3
|
-
spawn: vi.fn(),
|
|
4
|
-
}));
|
|
5
|
-
// The global test/setup.ts mocks '../adb.js' wholesale (including
|
|
6
|
-
// waitForEmulator itself), which is right for consumers of this module but
|
|
7
|
-
// defeats the purpose here: this suite exercises the *real* polling loop
|
|
8
|
-
// (and its private waitWithSignal helper) to catch timer/listener leaks.
|
|
9
|
-
// Re-declaring the mock for this file restores the actual implementation,
|
|
10
|
-
// while `spawn` and `getAdbBinaryPath` (genuine cross-module imports) are
|
|
11
|
-
// swapped out to keep `getDeviceIds()` from touching a real adb binary.
|
|
12
|
-
vi.mock('../adb.js', async () => {
|
|
13
|
-
const actual = await vi.importActual('../adb.js');
|
|
14
|
-
return actual;
|
|
15
|
-
});
|
|
16
|
-
vi.mock('../environment.js', async () => {
|
|
17
|
-
const actual = await vi.importActual('../environment.js');
|
|
18
|
-
return { ...actual, getAdbBinaryPath: () => '/fake/sdk/platform-tools/adb' };
|
|
19
|
-
});
|
|
20
|
-
vi.mock('@react-native-harness/tools', async () => {
|
|
21
|
-
const actual = await vi.importActual('@react-native-harness/tools');
|
|
22
|
-
return { ...actual, spawn: mocks.spawn };
|
|
23
|
-
});
|
|
24
|
-
const { waitForEmulator } = await import('../adb.js');
|
|
25
|
-
afterEach(() => {
|
|
26
|
-
vi.useRealTimers();
|
|
27
|
-
vi.restoreAllMocks();
|
|
28
|
-
});
|
|
29
|
-
describe('waitForEmulator polling', () => {
|
|
30
|
-
it('does not leak an abort listener per poll iteration when the delay wins', async () => {
|
|
31
|
-
vi.useFakeTimers();
|
|
32
|
-
// No matching device on any poll: `adb devices` reports an empty list.
|
|
33
|
-
mocks.spawn.mockResolvedValue({ stdout: 'List of devices attached\n' });
|
|
34
|
-
const controller = new AbortController();
|
|
35
|
-
const addSpy = vi.spyOn(controller.signal, 'addEventListener');
|
|
36
|
-
const removeSpy = vi.spyOn(controller.signal, 'removeEventListener');
|
|
37
|
-
const resultPromise = waitForEmulator('Test_AVD', controller.signal);
|
|
38
|
-
resultPromise.catch(() => undefined);
|
|
39
|
-
for (let i = 0; i < 3; i += 1) {
|
|
40
|
-
await vi.advanceTimersByTimeAsync(1_000);
|
|
41
|
-
}
|
|
42
|
-
// Regression: each 1s poll iteration used to add an 'abort' listener
|
|
43
|
-
// to the local waitForAbort helper that was never removed when the
|
|
44
|
-
// delay (not the abort) won the race, leaking one listener per second
|
|
45
|
-
// of polling against this session-lifetime signal.
|
|
46
|
-
expect(addSpy.mock.calls.length).toBeGreaterThanOrEqual(3);
|
|
47
|
-
const addCallsBeforeAbort = addSpy.mock.calls.length;
|
|
48
|
-
controller.abort(new Error('teardown'));
|
|
49
|
-
await expect(resultPromise).rejects.toThrow('teardown');
|
|
50
|
-
// Every listener added while losing the race — including the one still
|
|
51
|
-
// pending when the abort itself won — must be removed again.
|
|
52
|
-
expect(removeSpy).toHaveBeenCalledTimes(addCallsBeforeAbort);
|
|
53
|
-
});
|
|
54
|
-
it('clears the pending 1s poll timer when the signal aborts mid-wait', async () => {
|
|
55
|
-
vi.useFakeTimers();
|
|
56
|
-
mocks.spawn.mockResolvedValue({ stdout: 'List of devices attached\n' });
|
|
57
|
-
const controller = new AbortController();
|
|
58
|
-
const resultPromise = waitForEmulator('Test_AVD', controller.signal);
|
|
59
|
-
resultPromise.catch(() => undefined);
|
|
60
|
-
// Let the loop enter its 1s wait, then abort before the timer fires.
|
|
61
|
-
await vi.advanceTimersByTimeAsync(0);
|
|
62
|
-
controller.abort(new Error('teardown'));
|
|
63
|
-
await expect(resultPromise).rejects.toThrow('teardown');
|
|
64
|
-
// Regression: the bare setTimeout-backed `wait()` used to have no
|
|
65
|
-
// handle to clear, so it stayed alive in the event loop for the rest
|
|
66
|
-
// of the 1s interval even after the abort branch won.
|
|
67
|
-
expect(vi.getTimerCount()).toBe(0);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"adb.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/adb.test.ts"],"names":[],"mappings":""}
|