@react-native-harness/jest 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 (86) hide show
  1. package/package.json +8 -8
  2. package/dist/__tests__/bridge.test.d.ts +0 -2
  3. package/dist/__tests__/bridge.test.d.ts.map +0 -1
  4. package/dist/__tests__/bridge.test.js +0 -167
  5. package/dist/__tests__/client-log-handler.test.d.ts +0 -2
  6. package/dist/__tests__/client-log-handler.test.d.ts.map +0 -1
  7. package/dist/__tests__/client-log-handler.test.js +0 -306
  8. package/dist/__tests__/crash-monitor.test.d.ts +0 -2
  9. package/dist/__tests__/crash-monitor.test.d.ts.map +0 -1
  10. package/dist/__tests__/crash-monitor.test.js +0 -230
  11. package/dist/__tests__/crash-supervisor.test.d.ts +0 -2
  12. package/dist/__tests__/crash-supervisor.test.d.ts.map +0 -1
  13. package/dist/__tests__/crash-supervisor.test.js +0 -151
  14. package/dist/__tests__/environment-reset.test.d.ts +0 -2
  15. package/dist/__tests__/environment-reset.test.d.ts.map +0 -1
  16. package/dist/__tests__/environment-reset.test.js +0 -238
  17. package/dist/__tests__/errors.test.d.ts +0 -2
  18. package/dist/__tests__/errors.test.d.ts.map +0 -1
  19. package/dist/__tests__/errors.test.js +0 -98
  20. package/dist/__tests__/execute-run.test.d.ts +0 -2
  21. package/dist/__tests__/execute-run.test.d.ts.map +0 -1
  22. package/dist/__tests__/execute-run.test.js +0 -639
  23. package/dist/__tests__/fixtures/mock-platform-runner.d.ts +0 -7
  24. package/dist/__tests__/fixtures/mock-platform-runner.d.ts.map +0 -1
  25. package/dist/__tests__/fixtures/mock-platform-runner.js +0 -6
  26. package/dist/__tests__/format-harness-error.test.d.ts +0 -2
  27. package/dist/__tests__/format-harness-error.test.d.ts.map +0 -1
  28. package/dist/__tests__/format-harness-error.test.js +0 -27
  29. package/dist/__tests__/harness-cache.test.d.ts +0 -2
  30. package/dist/__tests__/harness-cache.test.d.ts.map +0 -1
  31. package/dist/__tests__/harness-cache.test.js +0 -72
  32. package/dist/__tests__/harness-session-signal.test.d.ts +0 -2
  33. package/dist/__tests__/harness-session-signal.test.d.ts.map +0 -1
  34. package/dist/__tests__/harness-session-signal.test.js +0 -298
  35. package/dist/__tests__/harness-session.test.d.ts +0 -2
  36. package/dist/__tests__/harness-session.test.d.ts.map +0 -1
  37. package/dist/__tests__/harness-session.test.js +0 -233
  38. package/dist/__tests__/harness.test.d.ts +0 -2
  39. package/dist/__tests__/harness.test.d.ts.map +0 -1
  40. package/dist/__tests__/harness.test.js +0 -636
  41. package/dist/__tests__/hook-queue.test.d.ts +0 -2
  42. package/dist/__tests__/hook-queue.test.d.ts.map +0 -1
  43. package/dist/__tests__/hook-queue.test.js +0 -56
  44. package/dist/__tests__/index.test.d.ts +0 -2
  45. package/dist/__tests__/index.test.d.ts.map +0 -1
  46. package/dist/__tests__/index.test.js +0 -150
  47. package/dist/__tests__/metro-port.test.d.ts +0 -2
  48. package/dist/__tests__/metro-port.test.d.ts.map +0 -1
  49. package/dist/__tests__/metro-port.test.js +0 -54
  50. package/dist/__tests__/resource-lock.test.d.ts +0 -2
  51. package/dist/__tests__/resource-lock.test.d.ts.map +0 -1
  52. package/dist/__tests__/resource-lock.test.js +0 -138
  53. package/dist/__tests__/run.test.d.ts +0 -2
  54. package/dist/__tests__/run.test.d.ts.map +0 -1
  55. package/dist/__tests__/run.test.js +0 -48
  56. package/dist/__tests__/test-file-platform-filter.test.d.ts +0 -2
  57. package/dist/__tests__/test-file-platform-filter.test.d.ts.map +0 -1
  58. package/dist/__tests__/test-file-platform-filter.test.js +0 -47
  59. package/dist/cli-args.test.d.ts +0 -2
  60. package/dist/cli-args.test.d.ts.map +0 -1
  61. package/dist/cli-args.test.js +0 -1
  62. package/dist/diagnostics/__tests__/derivers.test.d.ts +0 -2
  63. package/dist/diagnostics/__tests__/derivers.test.d.ts.map +0 -1
  64. package/dist/diagnostics/__tests__/derivers.test.js +0 -248
  65. package/dist/diagnostics/__tests__/report.test.d.ts +0 -2
  66. package/dist/diagnostics/__tests__/report.test.d.ts.map +0 -1
  67. package/dist/diagnostics/__tests__/report.test.js +0 -97
  68. package/dist/tsconfig.lib.tsbuildinfo +0 -1
  69. package/src/__tests__/bridge.test.ts +0 -224
  70. package/src/__tests__/client-log-handler.test.ts +0 -364
  71. package/src/__tests__/crash-monitor.test.ts +0 -323
  72. package/src/__tests__/environment-reset.test.ts +0 -308
  73. package/src/__tests__/errors.test.ts +0 -157
  74. package/src/__tests__/execute-run.test.ts +0 -849
  75. package/src/__tests__/format-harness-error.test.ts +0 -32
  76. package/src/__tests__/harness-cache.test.ts +0 -91
  77. package/src/__tests__/harness-session.test.ts +0 -303
  78. package/src/__tests__/hook-queue.test.ts +0 -77
  79. package/src/__tests__/index.test.ts +0 -221
  80. package/src/__tests__/metro-port.test.ts +0 -63
  81. package/src/__tests__/resource-lock.test.ts +0 -179
  82. package/src/__tests__/run.test.ts +0 -74
  83. package/src/__tests__/test-file-platform-filter.test.ts +0 -83
  84. package/src/diagnostics/__tests__/derivers.test.ts +0 -300
  85. package/src/diagnostics/__tests__/report.test.ts +0 -128
  86. 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
- });