@react-native-harness/runtime 1.0.0-alpha.22 → 1.0.0-alpha.24

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 (345) hide show
  1. package/.babelrc.js +23 -0
  2. package/assets/harness-module-system.js +73 -0
  3. package/dist/NativeHarness.d.ts +41 -0
  4. package/dist/NativeHarness.d.ts.map +1 -0
  5. package/dist/NativeHarness.js +2 -0
  6. package/dist/bundler/bundle.d.ts +2 -0
  7. package/dist/bundler/bundle.d.ts.map +1 -0
  8. package/dist/bundler/bundle.js +21 -0
  9. package/dist/bundler/errors.d.ts +15 -0
  10. package/dist/bundler/errors.d.ts.map +1 -0
  11. package/dist/bundler/errors.js +29 -0
  12. package/dist/bundler/evaluate.d.ts +2 -0
  13. package/dist/bundler/evaluate.d.ts.map +1 -0
  14. package/dist/bundler/evaluate.js +18 -0
  15. package/dist/bundler/factory.d.ts +3 -0
  16. package/dist/bundler/factory.d.ts.map +1 -0
  17. package/dist/bundler/factory.js +36 -0
  18. package/dist/bundler/index.d.ts +4 -0
  19. package/dist/bundler/index.d.ts.map +1 -0
  20. package/dist/bundler/index.js +2 -0
  21. package/dist/bundler/types.d.ts +7 -0
  22. package/dist/bundler/types.d.ts.map +1 -0
  23. package/dist/bundler/types.js +1 -0
  24. package/dist/client/factory.d.ts +2 -0
  25. package/dist/client/factory.d.ts.map +1 -0
  26. package/dist/client/factory.js +75 -0
  27. package/dist/client/getDeviceDescriptor.d.ts +8 -0
  28. package/dist/client/getDeviceDescriptor.d.ts.map +1 -0
  29. package/dist/client/getDeviceDescriptor.js +40 -0
  30. package/dist/client/getWSServer.d.ts +2 -0
  31. package/dist/client/getWSServer.d.ts.map +1 -0
  32. package/dist/client/getWSServer.js +8 -0
  33. package/dist/client/index.d.ts +2 -0
  34. package/dist/client/index.d.ts.map +1 -0
  35. package/dist/client/index.js +1 -0
  36. package/dist/client/setup-files.d.ts +12 -0
  37. package/dist/client/setup-files.d.ts.map +1 -0
  38. package/dist/client/setup-files.js +60 -0
  39. package/dist/client/store.d.ts +4 -0
  40. package/dist/client/store.d.ts.map +1 -0
  41. package/dist/client/store.js +10 -0
  42. package/dist/collector/errors.d.ts +8 -0
  43. package/dist/collector/errors.d.ts.map +1 -0
  44. package/dist/collector/errors.js +20 -0
  45. package/dist/collector/factory.d.ts +3 -0
  46. package/dist/collector/factory.d.ts.map +1 -0
  47. package/dist/collector/factory.js +25 -0
  48. package/dist/collector/functions.d.ts +22 -0
  49. package/dist/collector/functions.d.ts.map +1 -0
  50. package/dist/collector/functions.js +279 -0
  51. package/dist/collector/index.d.ts +5 -0
  52. package/dist/collector/index.d.ts.map +1 -0
  53. package/dist/collector/index.js +3 -0
  54. package/dist/collector/types.d.ts +10 -0
  55. package/dist/collector/types.d.ts.map +1 -0
  56. package/dist/collector/types.js +1 -0
  57. package/dist/collector/validation.d.ts +4 -0
  58. package/dist/collector/validation.d.ts.map +1 -0
  59. package/dist/collector/validation.js +15 -0
  60. package/dist/constants.d.ts +2 -0
  61. package/dist/constants.d.ts.map +1 -0
  62. package/dist/constants.js +1 -0
  63. package/dist/disableHMRWhenReady.d.ts +2 -0
  64. package/dist/disableHMRWhenReady.d.ts.map +1 -0
  65. package/dist/disableHMRWhenReady.js +26 -0
  66. package/dist/entry-point.d.ts +2 -0
  67. package/dist/entry-point.d.ts.map +1 -0
  68. package/dist/entry-point.js +10 -0
  69. package/dist/errors.d.ts +6 -0
  70. package/dist/errors.d.ts.map +1 -0
  71. package/dist/errors.js +13 -0
  72. package/dist/expect/expect.d.ts +9 -0
  73. package/dist/expect/expect.d.ts.map +1 -0
  74. package/dist/expect/expect.js +77 -0
  75. package/dist/expect/index.d.ts +2 -0
  76. package/dist/expect/index.d.ts.map +1 -0
  77. package/dist/expect/index.js +1 -0
  78. package/dist/expect/matchers/toMatchImageSnapshot.d.ts +13 -0
  79. package/dist/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
  80. package/dist/expect/matchers/toMatchImageSnapshot.js +23 -0
  81. package/dist/expect/setup.d.ts +2 -0
  82. package/dist/expect/setup.d.ts.map +1 -0
  83. package/dist/expect/setup.js +7 -0
  84. package/dist/filtering/index.d.ts +2 -0
  85. package/dist/filtering/index.d.ts.map +1 -0
  86. package/dist/filtering/index.js +1 -0
  87. package/dist/filtering/testNameFilter.d.ts +12 -0
  88. package/dist/filtering/testNameFilter.d.ts.map +1 -0
  89. package/dist/filtering/testNameFilter.js +56 -0
  90. package/dist/globals.d.ts +19 -0
  91. package/dist/globals.d.ts.map +1 -0
  92. package/dist/globals.js +7 -0
  93. package/dist/index.d.ts +11 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/initialize.d.ts +2 -0
  96. package/dist/initialize.d.ts.map +1 -0
  97. package/dist/initialize.js +24 -0
  98. package/dist/jest-mock.d.ts +2 -0
  99. package/dist/jest-mock.d.ts.map +1 -0
  100. package/dist/jest-mock.js +25 -0
  101. package/dist/mocker/index.d.ts +2 -0
  102. package/dist/mocker/index.d.ts.map +1 -0
  103. package/dist/mocker/index.js +1 -0
  104. package/dist/mocker/registry.d.ts +6 -0
  105. package/dist/mocker/registry.d.ts.map +1 -0
  106. package/dist/mocker/registry.js +50 -0
  107. package/dist/mocker/types.d.ts +6 -0
  108. package/dist/mocker/types.d.ts.map +1 -0
  109. package/dist/mocker/types.js +1 -0
  110. package/dist/namespace.d.ts +18 -0
  111. package/dist/namespace.d.ts.map +1 -0
  112. package/dist/namespace.js +19 -0
  113. package/dist/polyfills.d.ts +11 -0
  114. package/dist/polyfills.d.ts.map +1 -0
  115. package/dist/polyfills.js +13 -0
  116. package/dist/render/ErrorBoundary.d.ts +17 -0
  117. package/dist/render/ErrorBoundary.d.ts.map +1 -0
  118. package/dist/render/ErrorBoundary.js +73 -0
  119. package/dist/render/TestComponentOverlay.d.ts +3 -0
  120. package/dist/render/TestComponentOverlay.d.ts.map +1 -0
  121. package/dist/render/TestComponentOverlay.js +55 -0
  122. package/dist/render/cleanup.d.ts +2 -0
  123. package/dist/render/cleanup.d.ts.map +1 -0
  124. package/dist/render/cleanup.js +6 -0
  125. package/dist/render/index.d.ts +6 -0
  126. package/dist/render/index.d.ts.map +1 -0
  127. package/dist/render/index.js +68 -0
  128. package/dist/render/queries.d.ts +7 -0
  129. package/dist/render/queries.d.ts.map +1 -0
  130. package/dist/render/queries.js +99 -0
  131. package/dist/render/setup.d.ts +2 -0
  132. package/dist/render/setup.d.ts.map +1 -0
  133. package/dist/render/setup.js +7 -0
  134. package/dist/render/types.d.ts +12 -0
  135. package/dist/render/types.d.ts.map +1 -0
  136. package/dist/render/types.js +1 -0
  137. package/dist/runHarnessTestsInModule.d.ts +9 -0
  138. package/dist/runHarnessTestsInModule.d.ts.map +1 -0
  139. package/dist/runHarnessTestsInModule.js +57 -0
  140. package/dist/runner/context.d.ts +10 -0
  141. package/dist/runner/context.d.ts.map +1 -0
  142. package/dist/runner/context.js +6 -0
  143. package/dist/runner/errors.d.ts +11 -0
  144. package/dist/runner/errors.d.ts.map +1 -0
  145. package/dist/runner/errors.js +41 -0
  146. package/dist/runner/factory.d.ts +3 -0
  147. package/dist/runner/factory.d.ts.map +1 -0
  148. package/dist/runner/factory.js +27 -0
  149. package/dist/runner/hooks.d.ts +4 -0
  150. package/dist/runner/hooks.d.ts.map +1 -0
  151. package/dist/runner/hooks.js +39 -0
  152. package/dist/runner/index.d.ts +5 -0
  153. package/dist/runner/index.d.ts.map +1 -0
  154. package/dist/runner/index.js +3 -0
  155. package/dist/runner/runSuite.d.ts +7 -0
  156. package/dist/runner/runSuite.d.ts.map +1 -0
  157. package/dist/runner/runSuite.js +199 -0
  158. package/dist/runner/types.d.ts +18 -0
  159. package/dist/runner/types.d.ts.map +1 -0
  160. package/dist/runner/types.js +1 -0
  161. package/dist/screen/index.d.ts +50 -0
  162. package/dist/screen/index.d.ts.map +1 -0
  163. package/dist/screen/index.js +46 -0
  164. package/dist/spy/index.d.ts +2 -0
  165. package/dist/spy/index.d.ts.map +1 -0
  166. package/dist/spy/index.js +2 -0
  167. package/dist/symbolicate.d.ts +17 -0
  168. package/dist/symbolicate.d.ts.map +1 -0
  169. package/dist/symbolicate.js +30 -0
  170. package/dist/tsconfig.lib.tsbuildinfo +1 -0
  171. package/dist/ui/ReadyScreen.d.ts +2 -0
  172. package/dist/ui/ReadyScreen.d.ts.map +1 -0
  173. package/dist/ui/ReadyScreen.js +103 -0
  174. package/dist/ui/WrongEnvironmentScreen.d.ts +2 -0
  175. package/dist/ui/WrongEnvironmentScreen.d.ts.map +1 -0
  176. package/dist/ui/WrongEnvironmentScreen.js +79 -0
  177. package/dist/ui/index.d.ts +2 -0
  178. package/dist/ui/index.d.ts.map +1 -0
  179. package/dist/ui/index.js +3 -0
  180. package/dist/ui/state.d.ts +20 -0
  181. package/dist/ui/state.d.ts.map +1 -0
  182. package/dist/ui/state.js +28 -0
  183. package/dist/userEvent/index.d.ts +16 -0
  184. package/dist/userEvent/index.d.ts.map +1 -0
  185. package/dist/userEvent/index.js +31 -0
  186. package/dist/utils/dev-server.d.ts +2 -0
  187. package/dist/utils/dev-server.d.ts.map +1 -0
  188. package/dist/utils/dev-server.js +10 -0
  189. package/dist/utils/emitter.d.ts +16 -0
  190. package/dist/utils/emitter.d.ts.map +1 -0
  191. package/dist/utils/emitter.js +39 -0
  192. package/dist/waitFor.d.ts +21 -0
  193. package/dist/waitFor.d.ts.map +1 -0
  194. package/dist/waitFor.js +137 -0
  195. package/eslint.config.mjs +10 -0
  196. package/out-tsc/vitest/src/__tests__/collector.test.d.ts +2 -0
  197. package/out-tsc/vitest/src/__tests__/collector.test.d.ts.map +1 -0
  198. package/out-tsc/vitest/src/__tests__/error-handling.test.d.ts +2 -0
  199. package/out-tsc/vitest/src/__tests__/error-handling.test.d.ts.map +1 -0
  200. package/out-tsc/vitest/src/__tests__/expect.test.d.ts +2 -0
  201. package/out-tsc/vitest/src/__tests__/expect.test.d.ts.map +1 -0
  202. package/out-tsc/vitest/src/__tests__/initialize.test.d.ts +2 -0
  203. package/out-tsc/vitest/src/__tests__/initialize.test.d.ts.map +1 -0
  204. package/out-tsc/vitest/src/__tests__/spy.test.d.ts +2 -0
  205. package/out-tsc/vitest/src/__tests__/spy.test.d.ts.map +1 -0
  206. package/out-tsc/vitest/src/bundler/bundle.d.ts +2 -0
  207. package/out-tsc/vitest/src/bundler/bundle.d.ts.map +1 -0
  208. package/out-tsc/vitest/src/bundler/errors.d.ts +15 -0
  209. package/out-tsc/vitest/src/bundler/errors.d.ts.map +1 -0
  210. package/out-tsc/vitest/src/bundler/evaluate.d.ts +2 -0
  211. package/out-tsc/vitest/src/bundler/evaluate.d.ts.map +1 -0
  212. package/out-tsc/vitest/src/bundler/factory.d.ts +3 -0
  213. package/out-tsc/vitest/src/bundler/factory.d.ts.map +1 -0
  214. package/out-tsc/vitest/src/bundler/index.d.ts +4 -0
  215. package/out-tsc/vitest/src/bundler/index.d.ts.map +1 -0
  216. package/out-tsc/vitest/src/bundler/types.d.ts +7 -0
  217. package/out-tsc/vitest/src/bundler/types.d.ts.map +1 -0
  218. package/out-tsc/vitest/src/client/factory.d.ts +2 -0
  219. package/out-tsc/vitest/src/client/factory.d.ts.map +1 -0
  220. package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts +8 -0
  221. package/out-tsc/vitest/src/client/getDeviceDescriptor.d.ts.map +1 -0
  222. package/out-tsc/vitest/src/client/getWSServer.d.ts +2 -0
  223. package/out-tsc/vitest/src/client/getWSServer.d.ts.map +1 -0
  224. package/out-tsc/vitest/src/client/index.d.ts +2 -0
  225. package/out-tsc/vitest/src/client/index.d.ts.map +1 -0
  226. package/out-tsc/vitest/src/client/setup-files.d.ts +12 -0
  227. package/out-tsc/vitest/src/client/setup-files.d.ts.map +1 -0
  228. package/out-tsc/vitest/src/client/store.d.ts +4 -0
  229. package/out-tsc/vitest/src/client/store.d.ts.map +1 -0
  230. package/out-tsc/vitest/src/collector/errors.d.ts +8 -0
  231. package/out-tsc/vitest/src/collector/errors.d.ts.map +1 -0
  232. package/out-tsc/vitest/src/collector/factory.d.ts +3 -0
  233. package/out-tsc/vitest/src/collector/factory.d.ts.map +1 -0
  234. package/out-tsc/vitest/src/collector/functions.d.ts +22 -0
  235. package/out-tsc/vitest/src/collector/functions.d.ts.map +1 -0
  236. package/out-tsc/vitest/src/collector/index.d.ts +5 -0
  237. package/out-tsc/vitest/src/collector/index.d.ts.map +1 -0
  238. package/out-tsc/vitest/src/collector/types.d.ts +10 -0
  239. package/out-tsc/vitest/src/collector/types.d.ts.map +1 -0
  240. package/out-tsc/vitest/src/collector/validation.d.ts +4 -0
  241. package/out-tsc/vitest/src/collector/validation.d.ts.map +1 -0
  242. package/out-tsc/vitest/src/constants.d.ts +2 -0
  243. package/out-tsc/vitest/src/constants.d.ts.map +1 -0
  244. package/out-tsc/vitest/src/disableHMRWhenReady.d.ts +2 -0
  245. package/out-tsc/vitest/src/disableHMRWhenReady.d.ts.map +1 -0
  246. package/out-tsc/vitest/src/entry-point.d.ts +2 -0
  247. package/out-tsc/vitest/src/entry-point.d.ts.map +1 -0
  248. package/out-tsc/vitest/src/errors.d.ts +6 -0
  249. package/out-tsc/vitest/src/errors.d.ts.map +1 -0
  250. package/out-tsc/vitest/src/expect/expect.d.ts +9 -0
  251. package/out-tsc/vitest/src/expect/expect.d.ts.map +1 -0
  252. package/out-tsc/vitest/src/expect/index.d.ts +2 -0
  253. package/out-tsc/vitest/src/expect/index.d.ts.map +1 -0
  254. package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts +18 -0
  255. package/out-tsc/vitest/src/expect/matchers/toMatchImageSnapshot.d.ts.map +1 -0
  256. package/out-tsc/vitest/src/expect/setup.d.ts +2 -0
  257. package/out-tsc/vitest/src/expect/setup.d.ts.map +1 -0
  258. package/out-tsc/vitest/src/filtering/index.d.ts +2 -0
  259. package/out-tsc/vitest/src/filtering/index.d.ts.map +1 -0
  260. package/out-tsc/vitest/src/filtering/testNameFilter.d.ts +12 -0
  261. package/out-tsc/vitest/src/filtering/testNameFilter.d.ts.map +1 -0
  262. package/out-tsc/vitest/src/globals.d.ts +9 -0
  263. package/out-tsc/vitest/src/globals.d.ts.map +1 -0
  264. package/out-tsc/vitest/src/index.d.ts +11 -0
  265. package/out-tsc/vitest/src/index.d.ts.map +1 -0
  266. package/out-tsc/vitest/src/initialize.d.ts +2 -0
  267. package/out-tsc/vitest/src/initialize.d.ts.map +1 -0
  268. package/out-tsc/vitest/src/jest-mock.d.ts +2 -0
  269. package/out-tsc/vitest/src/jest-mock.d.ts.map +1 -0
  270. package/out-tsc/vitest/src/mocker/index.d.ts +2 -0
  271. package/out-tsc/vitest/src/mocker/index.d.ts.map +1 -0
  272. package/out-tsc/vitest/src/mocker/registry.d.ts +6 -0
  273. package/out-tsc/vitest/src/mocker/registry.d.ts.map +1 -0
  274. package/out-tsc/vitest/src/mocker/types.d.ts +6 -0
  275. package/out-tsc/vitest/src/mocker/types.d.ts.map +1 -0
  276. package/out-tsc/vitest/src/namespace.d.ts +18 -0
  277. package/out-tsc/vitest/src/namespace.d.ts.map +1 -0
  278. package/out-tsc/vitest/src/polyfills.d.ts +11 -0
  279. package/out-tsc/vitest/src/polyfills.d.ts.map +1 -0
  280. package/out-tsc/vitest/src/render/ErrorBoundary.d.ts +17 -0
  281. package/out-tsc/vitest/src/render/ErrorBoundary.d.ts.map +1 -0
  282. package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts +3 -0
  283. package/out-tsc/vitest/src/render/TestComponentOverlay.d.ts.map +1 -0
  284. package/out-tsc/vitest/src/render/cleanup.d.ts +2 -0
  285. package/out-tsc/vitest/src/render/cleanup.d.ts.map +1 -0
  286. package/out-tsc/vitest/src/render/index.d.ts +6 -0
  287. package/out-tsc/vitest/src/render/index.d.ts.map +1 -0
  288. package/out-tsc/vitest/src/render/setup.d.ts +2 -0
  289. package/out-tsc/vitest/src/render/setup.d.ts.map +1 -0
  290. package/out-tsc/vitest/src/render/types.d.ts +12 -0
  291. package/out-tsc/vitest/src/render/types.d.ts.map +1 -0
  292. package/out-tsc/vitest/src/runner/context.d.ts +10 -0
  293. package/out-tsc/vitest/src/runner/context.d.ts.map +1 -0
  294. package/out-tsc/vitest/src/runner/errors.d.ts +11 -0
  295. package/out-tsc/vitest/src/runner/errors.d.ts.map +1 -0
  296. package/out-tsc/vitest/src/runner/factory.d.ts +3 -0
  297. package/out-tsc/vitest/src/runner/factory.d.ts.map +1 -0
  298. package/out-tsc/vitest/src/runner/hooks.d.ts +4 -0
  299. package/out-tsc/vitest/src/runner/hooks.d.ts.map +1 -0
  300. package/out-tsc/vitest/src/runner/index.d.ts +5 -0
  301. package/out-tsc/vitest/src/runner/index.d.ts.map +1 -0
  302. package/out-tsc/vitest/src/runner/runSuite.d.ts +7 -0
  303. package/out-tsc/vitest/src/runner/runSuite.d.ts.map +1 -0
  304. package/out-tsc/vitest/src/runner/types.d.ts +18 -0
  305. package/out-tsc/vitest/src/runner/types.d.ts.map +1 -0
  306. package/out-tsc/vitest/src/screen/index.d.ts +8 -0
  307. package/out-tsc/vitest/src/screen/index.d.ts.map +1 -0
  308. package/out-tsc/vitest/src/spy/index.d.ts +2 -0
  309. package/out-tsc/vitest/src/spy/index.d.ts.map +1 -0
  310. package/out-tsc/vitest/src/symbolicate.d.ts +3 -0
  311. package/out-tsc/vitest/src/symbolicate.d.ts.map +1 -0
  312. package/out-tsc/vitest/src/ui/ReadyScreen.d.ts +2 -0
  313. package/out-tsc/vitest/src/ui/ReadyScreen.d.ts.map +1 -0
  314. package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts +2 -0
  315. package/out-tsc/vitest/src/ui/WrongEnvironmentScreen.d.ts.map +1 -0
  316. package/out-tsc/vitest/src/ui/index.d.ts +2 -0
  317. package/out-tsc/vitest/src/ui/index.d.ts.map +1 -0
  318. package/out-tsc/vitest/src/ui/state.d.ts +20 -0
  319. package/out-tsc/vitest/src/ui/state.d.ts.map +1 -0
  320. package/out-tsc/vitest/src/userEvent/index.d.ts +6 -0
  321. package/out-tsc/vitest/src/userEvent/index.d.ts.map +1 -0
  322. package/out-tsc/vitest/src/utils/dev-server.d.ts +2 -0
  323. package/out-tsc/vitest/src/utils/dev-server.d.ts.map +1 -0
  324. package/out-tsc/vitest/src/utils/emitter.d.ts +16 -0
  325. package/out-tsc/vitest/src/utils/emitter.d.ts.map +1 -0
  326. package/out-tsc/vitest/src/waitFor.d.ts +21 -0
  327. package/out-tsc/vitest/src/waitFor.d.ts.map +1 -0
  328. package/out-tsc/vitest/tsconfig.spec.tsbuildinfo +1 -0
  329. package/out-tsc/vitest/vite.config.d.ts +3 -0
  330. package/out-tsc/vitest/vite.config.d.ts.map +1 -0
  331. package/package.json +3 -13
  332. package/src/__tests__/collector.test.ts +553 -0
  333. package/src/__tests__/error-handling.test.ts +132 -0
  334. package/src/__tests__/spy.test.ts +538 -0
  335. package/src/client/getDeviceDescriptor.ts +10 -1
  336. package/src/disableHMRWhenReady.ts +8 -0
  337. package/src/entry-point.ts +10 -5
  338. package/src/react-native.d.ts +0 -27
  339. package/src/symbolicate.ts +35 -4
  340. package/src/utils/dev-server.ts +7 -0
  341. package/tsconfig.json +16 -0
  342. package/tsconfig.lib.json +34 -0
  343. package/tsconfig.spec.json +34 -0
  344. package/tsconfig.tsbuildinfo +1 -0
  345. package/vite.config.ts +27 -0
package/.babelrc.js ADDED
@@ -0,0 +1,23 @@
1
+ module.exports = function (api) {
2
+ api.cache(true);
3
+
4
+ return {
5
+ presets: [
6
+ [
7
+ '@nx/react/babel',
8
+ {
9
+ runtime: 'automatic',
10
+ useBuiltIns: 'usage',
11
+ },
12
+ ],
13
+ ],
14
+ plugins: [],
15
+ env: {
16
+ test: {
17
+ presets: [
18
+ ['module:@react-native/babel-preset', { useTransformReactJSX: true }],
19
+ ],
20
+ },
21
+ },
22
+ };
23
+ };
@@ -0,0 +1,73 @@
1
+ // @ts-nocheck
2
+ /* eslint-disable */
3
+
4
+ // This file is a polyfill that monkey-patches the Metro module system
5
+ // to allow capturing nested require calls.
6
+
7
+ (function (globalObject) {
8
+ const myRequire = function (id) {
9
+ return globalObject.__r(id);
10
+ };
11
+
12
+ const myImportDefault = function (id) {
13
+ return globalObject.__r.importDefault(id);
14
+ };
15
+
16
+ const myImportAll = function (id) {
17
+ return globalObject.__r.importAll(id);
18
+ };
19
+
20
+ // Monkey-patch define
21
+ const originalDefine = globalObject.__d;
22
+ globalObject.__d = function (factory, moduleId, dependencyMap) {
23
+ const wrappedFactory = function (...args) {
24
+ // Standard Metro with import support (7 arguments)
25
+ // args: global, require, importDefault, importAll, module, exports, dependencyMap
26
+ const global = args[0];
27
+ const moduleObject = args[4];
28
+ const exports = args[5];
29
+ const depMap = args[6];
30
+
31
+ return factory(
32
+ global,
33
+ myRequire,
34
+ myImportDefault,
35
+ myImportAll,
36
+ moduleObject,
37
+ exports,
38
+ depMap
39
+ );
40
+ };
41
+
42
+ // Call the original define with the wrapped factory
43
+ return originalDefine.call(this, wrappedFactory, moduleId, dependencyMap);
44
+ };
45
+
46
+ globalObject.__resetModule = function (moduleId) {
47
+ const module = globalObject.__r.getModules().get(moduleId);
48
+
49
+ if (!module) {
50
+ return;
51
+ }
52
+
53
+ module.hasError = false;
54
+ module.error = undefined;
55
+ module.isInitialized = false;
56
+ };
57
+
58
+ globalObject.__resetModules = function () {
59
+ const modules = globalObject.__r.getModules();
60
+
61
+ modules.forEach(function (mod, moduleId) {
62
+ globalObject.__resetModule(moduleId);
63
+ });
64
+ };
65
+ })(
66
+ typeof globalThis !== 'undefined'
67
+ ? globalThis
68
+ : typeof global !== 'undefined'
69
+ ? global
70
+ : typeof window !== 'undefined'
71
+ ? window
72
+ : this
73
+ );
@@ -0,0 +1,41 @@
1
+ import { type TurboModule } from 'react-native';
2
+ /**
3
+ * Represents the position and dimensions of a view in screen coordinates (points/dp).
4
+ */
5
+ export interface ViewInfo {
6
+ x: number;
7
+ y: number;
8
+ width: number;
9
+ height: number;
10
+ }
11
+ interface Spec extends TurboModule {
12
+ /**
13
+ * Simulates a native tap at the specified screen coordinates.
14
+ * Returns a promise that resolves when the tap action is complete.
15
+ */
16
+ simulateTap(x: number, y: number): Promise<void>;
17
+ /**
18
+ * Finds a view by its testID (accessibilityIdentifier on iOS, tag on Android).
19
+ * Returns null if no view is found.
20
+ */
21
+ queryByTestId(testId: string): ViewInfo | null;
22
+ /**
23
+ * Finds all views by testID (accessibilityIdentifier on iOS, tag on Android).
24
+ * Returns an empty array if no views are found.
25
+ */
26
+ queryAllByTestId(testId: string): ViewInfo[];
27
+ /**
28
+ * Finds a view by its accessibility label.
29
+ * Returns null if no view is found.
30
+ */
31
+ queryByAccessibilityLabel(label: string): ViewInfo | null;
32
+ /**
33
+ * Finds all views by accessibility label.
34
+ * Returns an empty array if no views are found.
35
+ */
36
+ queryAllByAccessibilityLabel(label: string): ViewInfo[];
37
+ }
38
+ export type HarnessModule = Spec;
39
+ declare const _default: Spec;
40
+ export default _default;
41
+ //# sourceMappingURL=NativeHarness.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NativeHarness.d.ts","sourceRoot":"","sources":["../src/NativeHarness.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,UAAU,IAAK,SAAQ,WAAW;IAChC;;;OAGG;IACH,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEjD;;;OAGG;IACH,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IAE/C;;;OAGG;IACH,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;IAE7C;;;OAGG;IACH,yBAAyB,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAAC;IAE1D;;;OAGG;IACH,4BAA4B,CAAC,KAAK,EAAE,MAAM,GAAG,QAAQ,EAAE,CAAC;CACzD;AAED,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC;;AAEjC,wBAAiE"}
@@ -0,0 +1,2 @@
1
+ import { TurboModuleRegistry } from 'react-native';
2
+ export default TurboModuleRegistry.getEnforcing('Harness');
@@ -0,0 +1,2 @@
1
+ export declare const fetchModule: (fileName: string) => Promise<string>;
2
+ //# sourceMappingURL=bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../../src/bundler/bundle.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,WAAW,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,MAAM,CAUlE,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { Platform } from 'react-native';
2
+ import { getDevServerUrl } from '../utils/dev-server.js';
3
+ import { BundlingFailedError } from './errors.js';
4
+ const getModuleUrl = (fileName) => {
5
+ const devServerUrl = getDevServerUrl();
6
+ const bundleName = fileName.split('.').slice(0, -1).join('.') + '.bundle';
7
+ const urlSearchParams = new URLSearchParams({
8
+ modulesOnly: 'true',
9
+ platform: Platform.OS,
10
+ });
11
+ return `${devServerUrl}${bundleName}?${urlSearchParams.toString()}`;
12
+ };
13
+ export const fetchModule = async (fileName) => {
14
+ const url = getModuleUrl(fileName);
15
+ const response = await fetch(url);
16
+ const text = await response.text();
17
+ if (!response.ok) {
18
+ throw new BundlingFailedError(fileName, text);
19
+ }
20
+ return text;
21
+ };
@@ -0,0 +1,15 @@
1
+ export declare class ModuleNotFoundError extends Error {
2
+ readonly modulePath: string;
3
+ constructor(modulePath: string);
4
+ }
5
+ export declare class MalformedModuleError extends Error {
6
+ readonly modulePath: string;
7
+ readonly reason: string;
8
+ constructor(modulePath: string, reason: string);
9
+ }
10
+ export declare class BundlingFailedError extends Error {
11
+ readonly modulePath: string;
12
+ readonly reason: string;
13
+ constructor(modulePath: string, reason: string);
14
+ }
15
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/bundler/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,oBAAqB,SAAQ,KAAK;aAE3B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAKjC;AAED,qBAAa,mBAAoB,SAAQ,KAAK;aAE1B,UAAU,EAAE,MAAM;aAClB,MAAM,EAAE,MAAM;gBADd,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM;CAMjC"}
@@ -0,0 +1,29 @@
1
+ export class ModuleNotFoundError extends Error {
2
+ modulePath;
3
+ constructor(modulePath) {
4
+ super(`Module ${modulePath} not found`);
5
+ this.modulePath = modulePath;
6
+ this.name = 'ModuleNotFoundError';
7
+ }
8
+ }
9
+ export class MalformedModuleError extends Error {
10
+ modulePath;
11
+ reason;
12
+ constructor(modulePath, reason) {
13
+ super(`Module ${modulePath} is malformed: ${reason}`);
14
+ this.modulePath = modulePath;
15
+ this.reason = reason;
16
+ this.name = 'MalformedModuleError';
17
+ }
18
+ }
19
+ export class BundlingFailedError extends Error {
20
+ modulePath;
21
+ reason;
22
+ constructor(modulePath, reason) {
23
+ const reasonMessage = JSON.parse(reason).message ?? reason;
24
+ super(`Bundling of ${modulePath} failed with error:\n\n${reasonMessage}\n`);
25
+ this.modulePath = modulePath;
26
+ this.reason = reason;
27
+ this.name = 'BundlingFailedError';
28
+ }
29
+ }
@@ -0,0 +1,2 @@
1
+ export declare const evaluateModule: (moduleJs: string, modulePath: string) => void;
2
+ //# sourceMappingURL=evaluate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate.d.ts","sourceRoot":"","sources":["../../src/bundler/evaluate.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,EAAE,YAAY,MAAM,KAAG,IAsBrE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { MalformedModuleError } from './errors.js';
2
+ export const evaluateModule = (moduleJs, modulePath) => {
3
+ const __rMatches = Array.from(moduleJs.matchAll(/__r\((\d+)\)/g));
4
+ if (__rMatches.length === 0) {
5
+ throw new MalformedModuleError(modulePath, 'No __r function found');
6
+ }
7
+ // Get the last match as there may be many require calls
8
+ const __rMatch = __rMatches[__rMatches.length - 1];
9
+ const __rParam = __rMatch[1];
10
+ if (!__rParam) {
11
+ throw new MalformedModuleError(modulePath, 'No __r parameter found');
12
+ }
13
+ const moduleId = Number(__rParam);
14
+ // This is important as if module was already initialized, it would not be re-initialized
15
+ global.__resetModule(moduleId);
16
+ // eslint-disable-next-line no-eval
17
+ eval(moduleJs);
18
+ };
@@ -0,0 +1,3 @@
1
+ import { Bundler } from './types.js';
2
+ export declare const getBundler: () => Bundler;
3
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/bundler/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAIrC,eAAO,MAAM,UAAU,QAAO,OAoC7B,CAAC"}
@@ -0,0 +1,36 @@
1
+ import { getEmitter } from '../utils/emitter.js';
2
+ import { fetchModule } from './bundle.js';
3
+ import { BundlingFailedError } from './errors.js';
4
+ export const getBundler = () => {
5
+ const events = getEmitter();
6
+ return {
7
+ events,
8
+ getModule: async (filePath) => {
9
+ const bundlingStartTime = Date.now();
10
+ events.emit({
11
+ type: 'module-bundling-started',
12
+ file: filePath,
13
+ });
14
+ try {
15
+ const moduleJs = await fetchModule(filePath);
16
+ events.emit({
17
+ type: 'module-bundling-finished',
18
+ file: filePath,
19
+ duration: Date.now() - bundlingStartTime,
20
+ });
21
+ return moduleJs;
22
+ }
23
+ catch (error) {
24
+ events.emit({
25
+ type: 'module-bundling-failed',
26
+ file: filePath,
27
+ duration: Date.now() - bundlingStartTime,
28
+ error: error instanceof BundlingFailedError
29
+ ? error.reason
30
+ : 'Unknown error',
31
+ });
32
+ throw error;
33
+ }
34
+ },
35
+ };
36
+ };
@@ -0,0 +1,4 @@
1
+ export { evaluateModule } from './evaluate.js';
2
+ export { getBundler } from './factory.js';
3
+ export type { Bundler } from './types.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/bundler/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { evaluateModule } from './evaluate.js';
2
+ export { getBundler } from './factory.js';
@@ -0,0 +1,7 @@
1
+ import { BundlerEvents } from '@react-native-harness/bridge';
2
+ import { EventEmitter } from '../utils/emitter.js';
3
+ export type Bundler = {
4
+ events: EventEmitter<BundlerEvents>;
5
+ getModule: (filePath: string) => Promise<string>;
6
+ };
7
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/bundler/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAEnD,MAAM,MAAM,OAAO,GAAG;IACpB,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IACpC,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;CAClD,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export declare const getClient: () => Promise<import("@react-native-harness/bridge/client").BridgeClient>;
2
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/client/factory.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,SAAS,2EAsFrB,CAAC"}
@@ -0,0 +1,75 @@
1
+ import { getBridgeClient } from '@react-native-harness/bridge/client';
2
+ import { store } from '../ui/state.js';
3
+ import { getTestRunner } from '../runner/index.js';
4
+ import { getTestCollector } from '../collector/index.js';
5
+ import { combineEventEmitters } from '../utils/emitter.js';
6
+ import { getWSServer } from './getWSServer.js';
7
+ import { getBundler, evaluateModule } from '../bundler/index.js';
8
+ import { markTestsAsSkippedByName } from '../filtering/index.js';
9
+ import { setup } from '../render/setup.js';
10
+ import { runSetupFiles } from './setup-files.js';
11
+ import { setClient } from './store.js';
12
+ export const getClient = async () => {
13
+ const client = await getBridgeClient(getWSServer(), {
14
+ runTests: async () => {
15
+ throw new Error('Not implemented');
16
+ },
17
+ });
18
+ setClient(client);
19
+ client.rpc.$functions.runTests = async (path, options) => {
20
+ if (store.getState().status === 'running') {
21
+ throw new Error('Already running tests');
22
+ }
23
+ store.getState().setStatus('running');
24
+ let collector = null;
25
+ let runner = null;
26
+ let events = null;
27
+ let bundler = null;
28
+ try {
29
+ collector = getTestCollector();
30
+ runner = getTestRunner();
31
+ bundler = getBundler();
32
+ events = combineEventEmitters(collector.events, runner.events, bundler.events);
33
+ events.addListener((event) => {
34
+ client.rpc.emitEvent(event.type, event);
35
+ });
36
+ await runSetupFiles({
37
+ setupFiles: options.setupFiles ?? [],
38
+ setupFilesAfterEnv: [],
39
+ events: events,
40
+ bundler: bundler,
41
+ evaluateModule,
42
+ });
43
+ const moduleJs = await bundler.getModule(path);
44
+ const collectionResult = await collector.collect(async () => {
45
+ await runSetupFiles({
46
+ setupFiles: [],
47
+ setupFilesAfterEnv: options.setupFilesAfterEnv ?? [],
48
+ events: events,
49
+ bundler: bundler,
50
+ evaluateModule,
51
+ });
52
+ // Setup automatic cleanup for rendered components
53
+ setup();
54
+ evaluateModule(moduleJs, path);
55
+ }, path);
56
+ // Apply test name pattern by marking non-matching tests as skipped
57
+ const processedTestSuite = options.testNamePattern
58
+ ? markTestsAsSkippedByName(collectionResult.testSuite, options.testNamePattern)
59
+ : collectionResult.testSuite;
60
+ const result = await runner.run({
61
+ testSuite: processedTestSuite,
62
+ testFilePath: path,
63
+ runner: options.runner,
64
+ });
65
+ return result;
66
+ }
67
+ finally {
68
+ collector?.dispose();
69
+ runner?.dispose();
70
+ events?.clearAllListeners();
71
+ store.getState().setStatus('idle');
72
+ }
73
+ };
74
+ return client;
75
+ };
@@ -0,0 +1,8 @@
1
+ export type DeviceDescriptor = {
2
+ platform: 'ios' | 'android' | 'vega' | 'web';
3
+ manufacturer: string;
4
+ model: string;
5
+ osVersion: string;
6
+ };
7
+ export declare const getDeviceDescriptor: () => DeviceDescriptor;
8
+ //# sourceMappingURL=getDeviceDescriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDeviceDescriptor.d.ts","sourceRoot":"","sources":["../../src/client/getDeviceDescriptor.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,KAAK,CAAC;IAC7C,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,mBAAmB,QAAO,gBAwCtC,CAAC"}
@@ -0,0 +1,40 @@
1
+ import { Platform } from 'react-native';
2
+ const getPlatform = () => {
3
+ return Platform;
4
+ };
5
+ export const getDeviceDescriptor = () => {
6
+ const platform = getPlatform();
7
+ if (platform.OS === 'web') {
8
+ return {
9
+ platform: 'web',
10
+ manufacturer: '',
11
+ model: '',
12
+ osVersion: '',
13
+ };
14
+ }
15
+ if (platform.OS === 'ios') {
16
+ return {
17
+ platform: 'ios',
18
+ manufacturer: 'Apple',
19
+ model: 'Unknown',
20
+ osVersion: platform.constants.osVersion,
21
+ };
22
+ }
23
+ if (platform.OS === 'android') {
24
+ return {
25
+ platform: 'android',
26
+ manufacturer: platform.constants.Manufacturer,
27
+ model: platform.constants.Model,
28
+ osVersion: platform.constants.Release,
29
+ };
30
+ }
31
+ if (platform.OS === 'kepler') {
32
+ return {
33
+ platform: 'vega',
34
+ manufacturer: '',
35
+ model: '',
36
+ osVersion: '',
37
+ };
38
+ }
39
+ throw new Error('Unsupported platform');
40
+ };
@@ -0,0 +1,2 @@
1
+ export declare const getWSServer: () => string;
2
+ //# sourceMappingURL=getWSServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWSServer.d.ts","sourceRoot":"","sources":["../../src/client/getWSServer.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,WAAW,QAAO,MAM9B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { getDevServerUrl } from '../utils/dev-server.js';
2
+ import { WS_SERVER_PORT } from '../constants.js';
3
+ export const getWSServer = () => {
4
+ const devServerUrl = getDevServerUrl();
5
+ const hostname = devServerUrl.split('://')[1].split(':')[0];
6
+ const port = global.RN_HARNESS?.webSocketPort || WS_SERVER_PORT;
7
+ return `ws://${hostname}:${port}`;
8
+ };
@@ -0,0 +1,2 @@
1
+ export { getClient } from './factory.js';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export { getClient } from './factory.js';
@@ -0,0 +1,12 @@
1
+ import { EventEmitter } from '../utils/emitter.js';
2
+ import { Bundler } from '../bundler/index.js';
3
+ import { BundlerEvents } from '@react-native-harness/bridge';
4
+ export type RunSetupFilesOptions = {
5
+ setupFiles: string[];
6
+ setupFilesAfterEnv: string[];
7
+ events: EventEmitter<BundlerEvents>;
8
+ bundler: Bundler;
9
+ evaluateModule: (moduleJs: string, filePath: string) => void;
10
+ };
11
+ export declare const runSetupFiles: ({ setupFiles, setupFilesAfterEnv, events, bundler, evaluateModule, }: RunSetupFilesOptions) => Promise<void>;
12
+ //# sourceMappingURL=setup-files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-files.d.ts","sourceRoot":"","sources":["../../src/client/setup-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,MAAM,EAAE,YAAY,CAAC,aAAa,CAAC,CAAC;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAC;CAC9D,CAAC;AAEF,eAAO,MAAM,aAAa,GAAU,sEAMjC,oBAAoB,kBA8DtB,CAAC"}
@@ -0,0 +1,60 @@
1
+ export const runSetupFiles = async ({ setupFiles, setupFilesAfterEnv, events, bundler, evaluateModule, }) => {
2
+ for (const setupFile of setupFiles) {
3
+ const startTime = Date.now();
4
+ events.emit({
5
+ type: 'setup-file-bundling-started',
6
+ file: setupFile,
7
+ setupType: 'setupFiles',
8
+ });
9
+ try {
10
+ const setupModuleJs = await bundler.getModule(setupFile);
11
+ events.emit({
12
+ type: 'setup-file-bundling-finished',
13
+ file: setupFile,
14
+ setupType: 'setupFiles',
15
+ duration: Date.now() - startTime,
16
+ });
17
+ evaluateModule(setupModuleJs, setupFile);
18
+ }
19
+ catch (error) {
20
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
21
+ events.emit({
22
+ type: 'setup-file-bundling-failed',
23
+ file: setupFile,
24
+ setupType: 'setupFiles',
25
+ duration: Date.now() - startTime,
26
+ error: errorMessage,
27
+ });
28
+ throw error;
29
+ }
30
+ }
31
+ for (const setupFile of setupFilesAfterEnv) {
32
+ const startTime = Date.now();
33
+ events.emit({
34
+ type: 'setup-file-bundling-started',
35
+ file: setupFile,
36
+ setupType: 'setupFilesAfterEnv',
37
+ });
38
+ try {
39
+ const setupModuleJs = await bundler.getModule(setupFile);
40
+ events.emit({
41
+ type: 'setup-file-bundling-finished',
42
+ file: setupFile,
43
+ setupType: 'setupFilesAfterEnv',
44
+ duration: Date.now() - startTime,
45
+ });
46
+ evaluateModule(setupModuleJs, setupFile);
47
+ }
48
+ catch (error) {
49
+ const errorMessage = error instanceof Error ? error.message : 'Unknown error';
50
+ events.emit({
51
+ type: 'setup-file-bundling-failed',
52
+ file: setupFile,
53
+ setupType: 'setupFilesAfterEnv',
54
+ duration: Date.now() - startTime,
55
+ error: errorMessage,
56
+ });
57
+ throw error;
58
+ }
59
+ }
60
+ };
@@ -0,0 +1,4 @@
1
+ import type { BridgeClient } from '@react-native-harness/bridge/client';
2
+ export declare const setClient: (client: BridgeClient) => void;
3
+ export declare const getClientInstance: () => BridgeClient;
4
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/client/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AAIxE,eAAO,MAAM,SAAS,GAAI,QAAQ,YAAY,KAAG,IAEhD,CAAC;AAEF,eAAO,MAAM,iBAAiB,QAAO,YAOpC,CAAC"}
@@ -0,0 +1,10 @@
1
+ let clientInstance = null;
2
+ export const setClient = (client) => {
3
+ clientInstance = client;
4
+ };
5
+ export const getClientInstance = () => {
6
+ if (!clientInstance) {
7
+ throw new Error('Bridge client not initialized. This should not happen in normal operation.');
8
+ }
9
+ return clientInstance;
10
+ };
@@ -0,0 +1,8 @@
1
+ export type TestErrorCode = 'CONTEXT_NOT_INITIALIZED' | 'OUTSIDE_DESCRIBE_BLOCK' | 'INVALID_TEST_NAME' | 'DUPLICATE_TEST_NAME' | 'INVALID_FUNCTION';
2
+ export declare class TestError extends Error {
3
+ code: TestErrorCode;
4
+ functionName: string;
5
+ context?: Record<string, unknown> | undefined;
6
+ constructor(code: TestErrorCode, functionName: string, context?: Record<string, unknown> | undefined);
7
+ }
8
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/collector/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GACrB,yBAAyB,GACzB,wBAAwB,GACxB,mBAAmB,GACnB,qBAAqB,GACrB,kBAAkB,CAAC;AAEvB,qBAAa,SAAU,SAAQ,KAAK;IAEzB,IAAI,EAAE,aAAa;IACnB,YAAY,EAAE,MAAM;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;gBAFjC,IAAI,EAAE,aAAa,EACnB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,YAAA;CAe3C"}
@@ -0,0 +1,20 @@
1
+ export class TestError extends Error {
2
+ code;
3
+ functionName;
4
+ context;
5
+ constructor(code, functionName, context) {
6
+ const baseMessages = {
7
+ CONTEXT_NOT_INITIALIZED: 'Test context not initialized. Call collectTests() first.',
8
+ OUTSIDE_DESCRIBE_BLOCK: `${functionName}() must be called within a describe() block`,
9
+ INVALID_TEST_NAME: `${functionName}() requires a non-empty string name`,
10
+ DUPLICATE_TEST_NAME: `Duplicate test name "${context?.name}" in suite "${context?.suiteName}"`,
11
+ INVALID_FUNCTION: `${functionName}() requires a function as the second parameter`,
12
+ };
13
+ const message = baseMessages[code] || `Unknown error in ${functionName}()`;
14
+ super(message);
15
+ this.code = code;
16
+ this.functionName = functionName;
17
+ this.context = context;
18
+ this.name = 'TestError';
19
+ }
20
+ }
@@ -0,0 +1,3 @@
1
+ import { TestCollector } from './types.js';
2
+ export declare const getTestCollector: () => TestCollector;
3
+ //# sourceMappingURL=factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../src/collector/factory.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,eAAO,MAAM,gBAAgB,QAAO,aA0BnC,CAAC"}