@react-native-harness/jest 1.4.0 → 1.5.0
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/execute-run.d.ts.map +1 -1
- package/dist/execute-run.js +2 -1
- package/dist/harness-session.d.ts.map +1 -1
- package/dist/harness-session.js +74 -30
- package/dist/resource-lock.d.ts.map +1 -1
- package/dist/resource-lock.js +12 -2
- package/dist/toJestStatus.d.ts +4 -0
- package/dist/toJestStatus.d.ts.map +1 -0
- package/dist/toJestStatus.js +2 -0
- package/dist/toTestResult.d.ts +3 -2
- package/dist/toTestResult.d.ts.map +1 -1
- package/dist/toTestResult.js +2 -1
- package/package.json +8 -8
- package/src/execute-run.ts +2 -1
- package/src/harness-session.ts +86 -27
- package/src/resource-lock.ts +15 -2
- package/src/toJestStatus.ts +6 -0
- package/src/toTestResult.ts +5 -3
- package/dist/__tests__/bridge.test.d.ts +0 -2
- package/dist/__tests__/bridge.test.d.ts.map +0 -1
- package/dist/__tests__/bridge.test.js +0 -167
- package/dist/__tests__/client-log-handler.test.d.ts +0 -2
- package/dist/__tests__/client-log-handler.test.d.ts.map +0 -1
- package/dist/__tests__/client-log-handler.test.js +0 -306
- package/dist/__tests__/crash-monitor.test.d.ts +0 -2
- package/dist/__tests__/crash-monitor.test.d.ts.map +0 -1
- package/dist/__tests__/crash-monitor.test.js +0 -230
- package/dist/__tests__/crash-supervisor.test.d.ts +0 -2
- package/dist/__tests__/crash-supervisor.test.d.ts.map +0 -1
- package/dist/__tests__/crash-supervisor.test.js +0 -151
- package/dist/__tests__/environment-reset.test.d.ts +0 -2
- package/dist/__tests__/environment-reset.test.d.ts.map +0 -1
- package/dist/__tests__/environment-reset.test.js +0 -238
- package/dist/__tests__/errors.test.d.ts +0 -2
- package/dist/__tests__/errors.test.d.ts.map +0 -1
- package/dist/__tests__/errors.test.js +0 -98
- package/dist/__tests__/execute-run.test.d.ts +0 -2
- package/dist/__tests__/execute-run.test.d.ts.map +0 -1
- package/dist/__tests__/execute-run.test.js +0 -639
- package/dist/__tests__/fixtures/mock-platform-runner.d.ts +0 -7
- package/dist/__tests__/fixtures/mock-platform-runner.d.ts.map +0 -1
- package/dist/__tests__/fixtures/mock-platform-runner.js +0 -6
- package/dist/__tests__/format-harness-error.test.d.ts +0 -2
- package/dist/__tests__/format-harness-error.test.d.ts.map +0 -1
- package/dist/__tests__/format-harness-error.test.js +0 -27
- package/dist/__tests__/harness-cache.test.d.ts +0 -2
- package/dist/__tests__/harness-cache.test.d.ts.map +0 -1
- package/dist/__tests__/harness-cache.test.js +0 -72
- package/dist/__tests__/harness-session-signal.test.d.ts +0 -2
- package/dist/__tests__/harness-session-signal.test.d.ts.map +0 -1
- package/dist/__tests__/harness-session-signal.test.js +0 -298
- package/dist/__tests__/harness-session.test.d.ts +0 -2
- package/dist/__tests__/harness-session.test.d.ts.map +0 -1
- package/dist/__tests__/harness-session.test.js +0 -233
- package/dist/__tests__/harness.test.d.ts +0 -2
- package/dist/__tests__/harness.test.d.ts.map +0 -1
- package/dist/__tests__/harness.test.js +0 -636
- package/dist/__tests__/hook-queue.test.d.ts +0 -2
- package/dist/__tests__/hook-queue.test.d.ts.map +0 -1
- package/dist/__tests__/hook-queue.test.js +0 -56
- package/dist/__tests__/index.test.d.ts +0 -2
- package/dist/__tests__/index.test.d.ts.map +0 -1
- package/dist/__tests__/index.test.js +0 -150
- package/dist/__tests__/metro-port.test.d.ts +0 -2
- package/dist/__tests__/metro-port.test.d.ts.map +0 -1
- package/dist/__tests__/metro-port.test.js +0 -54
- package/dist/__tests__/resource-lock.test.d.ts +0 -2
- package/dist/__tests__/resource-lock.test.d.ts.map +0 -1
- package/dist/__tests__/resource-lock.test.js +0 -138
- package/dist/__tests__/run.test.d.ts +0 -2
- package/dist/__tests__/run.test.d.ts.map +0 -1
- package/dist/__tests__/run.test.js +0 -48
- package/dist/__tests__/test-file-platform-filter.test.d.ts +0 -2
- package/dist/__tests__/test-file-platform-filter.test.d.ts.map +0 -1
- package/dist/__tests__/test-file-platform-filter.test.js +0 -47
- package/dist/cli-args.test.d.ts +0 -2
- package/dist/cli-args.test.d.ts.map +0 -1
- package/dist/cli-args.test.js +0 -1
- package/dist/crash-supervisor.d.ts +0 -21
- package/dist/crash-supervisor.d.ts.map +0 -1
- package/dist/crash-supervisor.js +0 -210
- package/dist/diagnostics/__tests__/derivers.test.d.ts +0 -2
- package/dist/diagnostics/__tests__/derivers.test.d.ts.map +0 -1
- package/dist/diagnostics/__tests__/derivers.test.js +0 -248
- package/dist/diagnostics/__tests__/report.test.d.ts +0 -2
- package/dist/diagnostics/__tests__/report.test.d.ts.map +0 -1
- package/dist/diagnostics/__tests__/report.test.js +0 -97
- package/dist/event-mapper.d.ts +0 -16
- package/dist/event-mapper.d.ts.map +0 -1
- package/dist/event-mapper.js +0 -120
- package/dist/global-setup.d.ts +0 -3
- package/dist/global-setup.d.ts.map +0 -1
- package/dist/global-setup.js +0 -60
- package/dist/global-teardown.d.ts +0 -3
- package/dist/global-teardown.d.ts.map +0 -1
- package/dist/global-teardown.js +0 -11
- package/dist/harness-reporter.d.ts +0 -8
- package/dist/harness-reporter.d.ts.map +0 -1
- package/dist/harness-reporter.js +0 -12
- package/dist/harness.d.ts +0 -47
- package/dist/harness.d.ts.map +0 -1
- package/dist/harness.js +0 -619
- package/dist/jest-options.d.ts +0 -2
- package/dist/jest-options.d.ts.map +0 -1
- package/dist/jest-options.js +0 -1
- package/dist/setup.d.ts +0 -3
- package/dist/setup.d.ts.map +0 -1
- package/dist/setup.js +0 -80
- package/dist/teardown.d.ts +0 -3
- package/dist/teardown.d.ts.map +0 -1
- package/dist/teardown.js +0 -10
- package/dist/tsconfig.lib.tsbuildinfo +0 -1
- package/dist/types.d.ts +0 -17
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -1
- package/src/__tests__/bridge.test.ts +0 -224
- package/src/__tests__/client-log-handler.test.ts +0 -364
- package/src/__tests__/crash-monitor.test.ts +0 -323
- package/src/__tests__/environment-reset.test.ts +0 -308
- package/src/__tests__/errors.test.ts +0 -157
- package/src/__tests__/execute-run.test.ts +0 -849
- package/src/__tests__/format-harness-error.test.ts +0 -32
- package/src/__tests__/harness-cache.test.ts +0 -91
- package/src/__tests__/harness-session.test.ts +0 -303
- package/src/__tests__/hook-queue.test.ts +0 -77
- package/src/__tests__/index.test.ts +0 -221
- package/src/__tests__/metro-port.test.ts +0 -63
- package/src/__tests__/resource-lock.test.ts +0 -179
- package/src/__tests__/run.test.ts +0 -74
- package/src/__tests__/test-file-platform-filter.test.ts +0 -83
- package/src/diagnostics/__tests__/derivers.test.ts +0 -300
- package/src/diagnostics/__tests__/report.test.ts +0 -128
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from 'vitest';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { AppBridgeDisconnectedError } from '@react-native-harness/bridge/server';
|
|
4
|
-
import { NativeCrashError, PlatformReadyTimeoutError } from '../errors.js';
|
|
5
|
-
|
|
6
|
-
describe('PlatformReadyTimeoutError', () => {
|
|
7
|
-
it('includes the configured timeout and config hint', () => {
|
|
8
|
-
expect(new PlatformReadyTimeoutError(300000).message).toBe(
|
|
9
|
-
'The platform did not become ready within 300000ms. Increase "platformReadyTimeout" if your device, simulator, or emulator needs more time to start.'
|
|
10
|
-
);
|
|
11
|
-
});
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
describe('NativeCrashError', () => {
|
|
15
|
-
it('reports the extracted crash log path when available', () => {
|
|
16
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
17
|
-
phase: 'execution',
|
|
18
|
-
artifactPath: path.join(
|
|
19
|
-
process.cwd(),
|
|
20
|
-
'.harness',
|
|
21
|
-
'crash-reports',
|
|
22
|
-
'crash.ips'
|
|
23
|
-
),
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
expect(error.message).toContain(
|
|
27
|
-
`Harness extracted the crash log: ${path.join(
|
|
28
|
-
'.harness',
|
|
29
|
-
'crash-reports',
|
|
30
|
-
'crash.ips'
|
|
31
|
-
)}`
|
|
32
|
-
);
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it('lists enrichment artifact paths when available', () => {
|
|
36
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
37
|
-
phase: 'execution',
|
|
38
|
-
artifactPath: path.join(
|
|
39
|
-
process.cwd(),
|
|
40
|
-
'.harness',
|
|
41
|
-
'crash-reports',
|
|
42
|
-
'logcat.txt'
|
|
43
|
-
),
|
|
44
|
-
enrichmentArtifacts: [
|
|
45
|
-
{
|
|
46
|
-
artifactType: 'dropbox-native-crash',
|
|
47
|
-
artifactPath: path.join(
|
|
48
|
-
process.cwd(),
|
|
49
|
-
'.harness',
|
|
50
|
-
'crash-reports',
|
|
51
|
-
'dropbox-native-crash.txt'
|
|
52
|
-
),
|
|
53
|
-
},
|
|
54
|
-
],
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
expect(error.message).toContain('Additional crash artifacts:');
|
|
58
|
-
expect(error.message).toContain(
|
|
59
|
-
path.join('.harness', 'crash-reports', 'dropbox-native-crash.txt')
|
|
60
|
-
);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
it('reports crash log extraction failure when no artifact was pulled', () => {
|
|
64
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
65
|
-
phase: 'execution',
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
expect(error.message).toContain("Harness couldn't extract the crash log.");
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
it('formats the extracted stack trace in the error message', () => {
|
|
72
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
73
|
-
phase: 'execution',
|
|
74
|
-
processName: 'HarnessPlayground',
|
|
75
|
-
pid: 1234,
|
|
76
|
-
signal: 'SIGTRAP',
|
|
77
|
-
exceptionType: 'EXC_BREAKPOINT',
|
|
78
|
-
stackTrace: [
|
|
79
|
-
'0 AppDelegate.crashIfRequested() (AppDelegate.swift:31)',
|
|
80
|
-
'1 AppDelegate.application(_:didFinishLaunchingWithOptions:) (AppDelegate.swift:56)',
|
|
81
|
-
],
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
expect(error.message).toContain(
|
|
85
|
-
' 0 AppDelegate.crashIfRequested() (AppDelegate.swift:31)'
|
|
86
|
-
);
|
|
87
|
-
expect(error.message).toContain(
|
|
88
|
-
' 1 AppDelegate.application(_:didFinishLaunchingWithOptions:) (AppDelegate.swift:56)'
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('omits single-line iOS summaries from the rendered error message', () => {
|
|
93
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
94
|
-
phase: 'startup',
|
|
95
|
-
artifactType: 'ios-crash-report',
|
|
96
|
-
summary:
|
|
97
|
-
'2026-03-12 13:46:18.154 Df HarnessPlayground[18007:65e716] [com.apple.dt.xctest:Default] notify_get_state check indicated test daemon not ready.',
|
|
98
|
-
processName: 'HarnessPlayground',
|
|
99
|
-
pid: 18007,
|
|
100
|
-
signal: 'SIGABRT',
|
|
101
|
-
exceptionType: 'EXC_CRASH',
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
expect(error.message).not.toContain(
|
|
105
|
-
'notify_get_state check indicated test daemon not ready'
|
|
106
|
-
);
|
|
107
|
-
expect(error.message).toContain('Signal: SIGABRT');
|
|
108
|
-
expect(error.message).toContain('Exception: EXC_CRASH');
|
|
109
|
-
expect(error.message).toContain('Process: HarnessPlayground (pid 18007)');
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
it('does not duplicate stack frames when the summary already contains a crash block', () => {
|
|
113
|
-
const frame =
|
|
114
|
-
'03-13 07:59:44.943 20373 20373 E AndroidRuntime: \tat com.harnessplayground.MainActivity.onCreate(MainActivity.kt:38)';
|
|
115
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
116
|
-
phase: 'startup',
|
|
117
|
-
summary: [
|
|
118
|
-
'--------- beginning of crash',
|
|
119
|
-
'03-13 07:59:44.943 20373 20373 E AndroidRuntime: FATAL EXCEPTION: main',
|
|
120
|
-
frame,
|
|
121
|
-
].join('\n'),
|
|
122
|
-
stackTrace: [frame],
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
expect(
|
|
126
|
-
error.message.match(/MainActivity\.onCreate\(MainActivity\.kt:38\)/g)
|
|
127
|
-
).toHaveLength(1);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
it('collapses the native crash stack header so jest does not reprint multiline messages', () => {
|
|
131
|
-
const error = new NativeCrashError('/tmp/crash.harness.ts', {
|
|
132
|
-
phase: 'startup',
|
|
133
|
-
summary: ['line one', 'line two'].join('\n'),
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
expect(error.stack).toBe(
|
|
137
|
-
'NativeCrashError: The native app crashed while preparing to run this test file.'
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
});
|
|
141
|
-
|
|
142
|
-
describe('AppBridgeDisconnectedError', () => {
|
|
143
|
-
it('explains likely causes without exposing an internal stack', () => {
|
|
144
|
-
const error = new AppBridgeDisconnectedError('app-disconnected');
|
|
145
|
-
|
|
146
|
-
expect(error.message).toBe(
|
|
147
|
-
'The app bridge disconnected during test execution. This can happen if the app was killed, crashed, reloaded, or restarted while the test file was running.'
|
|
148
|
-
);
|
|
149
|
-
expect(error.stack).toBe(`AppBridgeDisconnectedError: ${error.message}`);
|
|
150
|
-
});
|
|
151
|
-
|
|
152
|
-
it('uses a reconnection-specific message when a newer app connection replaces the old one', () => {
|
|
153
|
-
expect(new AppBridgeDisconnectedError('app-replaced').message).toBe(
|
|
154
|
-
'The app bridge was replaced by a newer app connection. This can happen when the app reloads, restarts, or reconnects while a test file is still running.'
|
|
155
|
-
);
|
|
156
|
-
});
|
|
157
|
-
});
|