@testing-library/react-native 14.0.0-alpha.0 → 14.0.0-alpha.2

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 (233) hide show
  1. package/README.md +8 -12
  2. package/build/act.d.ts +2 -4
  3. package/build/act.js +4 -5
  4. package/build/act.js.map +1 -1
  5. package/build/cleanup.d.ts +3 -1
  6. package/build/cleanup.js +8 -0
  7. package/build/cleanup.js.map +1 -1
  8. package/build/event-handler.d.ts +7 -0
  9. package/build/event-handler.js +30 -0
  10. package/build/event-handler.js.map +1 -0
  11. package/build/fire-event.d.ts +11 -4
  12. package/build/fire-event.js +43 -37
  13. package/build/fire-event.js.map +1 -1
  14. package/build/helpers/accessibility.d.ts +2 -2
  15. package/build/helpers/accessibility.js +5 -2
  16. package/build/helpers/accessibility.js.map +1 -1
  17. package/build/helpers/component-tree.d.ts +8 -8
  18. package/build/helpers/component-tree.js +19 -16
  19. package/build/helpers/component-tree.js.map +1 -1
  20. package/build/helpers/debug.d.ts +3 -3
  21. package/build/helpers/debug.js +8 -11
  22. package/build/helpers/debug.js.map +1 -1
  23. package/build/helpers/errors.js +4 -4
  24. package/build/helpers/errors.js.map +1 -1
  25. package/build/helpers/find-all.d.ts +1 -1
  26. package/build/helpers/find-all.js +7 -27
  27. package/build/helpers/find-all.js.map +1 -1
  28. package/build/helpers/format-element.d.ts +18 -0
  29. package/build/helpers/format-element.js +80 -0
  30. package/build/helpers/format-element.js.map +1 -0
  31. package/build/helpers/host-component-names.d.ts +1 -1
  32. package/build/helpers/host-component-names.js +6 -7
  33. package/build/helpers/host-component-names.js.map +1 -1
  34. package/build/helpers/logger.d.ts +28 -0
  35. package/build/helpers/logger.js +42 -0
  36. package/build/helpers/logger.js.map +1 -0
  37. package/build/helpers/{format-default.d.ts → map-props.d.ts} +1 -0
  38. package/build/helpers/{format-default.js → map-props.js} +2 -2
  39. package/build/helpers/map-props.js.map +1 -0
  40. package/build/helpers/matchers/match-accessibility-state.d.ts +1 -1
  41. package/build/helpers/matchers/match-accessibility-state.js.map +1 -1
  42. package/build/helpers/matchers/match-accessibility-value.d.ts +2 -2
  43. package/build/helpers/matchers/match-accessibility-value.js.map +1 -1
  44. package/build/helpers/matchers/match-label-text.d.ts +2 -2
  45. package/build/helpers/matchers/match-label-text.js.map +1 -1
  46. package/build/helpers/matchers/match-string-prop.d.ts +1 -1
  47. package/build/helpers/matchers/match-string-prop.js.map +1 -1
  48. package/build/helpers/matchers/match-text-content.d.ts +2 -2
  49. package/build/helpers/matchers/match-text-content.js.map +1 -1
  50. package/build/helpers/object.d.ts +1 -1
  51. package/build/helpers/object.js.map +1 -1
  52. package/build/helpers/pointer-events.d.ts +1 -1
  53. package/build/helpers/pointer-events.js +9 -5
  54. package/build/helpers/pointer-events.js.map +1 -1
  55. package/build/helpers/text-content.d.ts +1 -1
  56. package/build/helpers/text-content.js.map +1 -1
  57. package/build/helpers/text-input.d.ts +1 -1
  58. package/build/helpers/text-input.js.map +1 -1
  59. package/build/helpers/timers.d.ts +1 -1
  60. package/build/helpers/timers.js.map +1 -1
  61. package/build/helpers/wrap-async.d.ts +0 -1
  62. package/build/helpers/wrap-async.js +0 -1
  63. package/build/helpers/wrap-async.js.map +1 -1
  64. package/build/index.d.ts +0 -1
  65. package/build/index.flow.js +33 -36
  66. package/build/index.js +4 -16
  67. package/build/index.js.map +1 -1
  68. package/build/matchers/extend-expect.js +2 -2
  69. package/build/matchers/extend-expect.js.map +1 -1
  70. package/build/matchers/index.d.ts +1 -1
  71. package/build/matchers/index.js.map +1 -1
  72. package/build/matchers/to-be-busy.d.ts +1 -1
  73. package/build/matchers/to-be-busy.js +4 -1
  74. package/build/matchers/to-be-busy.js.map +1 -1
  75. package/build/matchers/to-be-checked.d.ts +1 -1
  76. package/build/matchers/to-be-checked.js +4 -1
  77. package/build/matchers/to-be-checked.js.map +1 -1
  78. package/build/matchers/to-be-disabled.d.ts +1 -1
  79. package/build/matchers/to-be-disabled.js +5 -2
  80. package/build/matchers/to-be-disabled.js.map +1 -1
  81. package/build/matchers/to-be-empty-element.d.ts +1 -1
  82. package/build/matchers/to-be-empty-element.js +9 -3
  83. package/build/matchers/to-be-empty-element.js.map +1 -1
  84. package/build/matchers/to-be-expanded.d.ts +1 -1
  85. package/build/matchers/to-be-expanded.js +5 -2
  86. package/build/matchers/to-be-expanded.js.map +1 -1
  87. package/build/matchers/to-be-on-the-screen.d.ts +1 -1
  88. package/build/matchers/to-be-on-the-screen.js +4 -1
  89. package/build/matchers/to-be-on-the-screen.js.map +1 -1
  90. package/build/matchers/to-be-partially-checked.d.ts +1 -1
  91. package/build/matchers/to-be-partially-checked.js +4 -1
  92. package/build/matchers/to-be-partially-checked.js.map +1 -1
  93. package/build/matchers/to-be-selected.d.ts +1 -1
  94. package/build/matchers/to-be-selected.js +4 -1
  95. package/build/matchers/to-be-selected.js.map +1 -1
  96. package/build/matchers/to-be-visible.d.ts +1 -1
  97. package/build/matchers/to-be-visible.js +8 -5
  98. package/build/matchers/to-be-visible.js.map +1 -1
  99. package/build/matchers/to-contain-element.d.ts +1 -1
  100. package/build/matchers/to-contain-element.js +5 -3
  101. package/build/matchers/to-contain-element.js.map +1 -1
  102. package/build/matchers/to-have-accessibility-value.d.ts +2 -2
  103. package/build/matchers/to-have-accessibility-value.js.map +1 -1
  104. package/build/matchers/to-have-accessible-name.d.ts +2 -2
  105. package/build/matchers/to-have-accessible-name.js.map +1 -1
  106. package/build/matchers/to-have-display-value.d.ts +2 -2
  107. package/build/matchers/to-have-display-value.js +1 -1
  108. package/build/matchers/to-have-display-value.js.map +1 -1
  109. package/build/matchers/to-have-prop.d.ts +1 -1
  110. package/build/matchers/to-have-prop.js.map +1 -1
  111. package/build/matchers/to-have-style.d.ts +2 -2
  112. package/build/matchers/to-have-style.js +1 -1
  113. package/build/matchers/to-have-style.js.map +1 -1
  114. package/build/matchers/to-have-text-content.d.ts +2 -2
  115. package/build/matchers/to-have-text-content.js.map +1 -1
  116. package/build/matchers/types.d.ts +4 -4
  117. package/build/matchers/types.js.map +1 -1
  118. package/build/matchers/utils.d.ts +1 -8
  119. package/build/matchers/utils.js +3 -48
  120. package/build/matchers/utils.js.map +1 -1
  121. package/build/native-state.d.ts +3 -3
  122. package/build/native-state.js +1 -1
  123. package/build/native-state.js.map +1 -1
  124. package/build/pure.d.ts +6 -4
  125. package/build/pure.js +28 -2
  126. package/build/pure.js.map +1 -1
  127. package/build/queries/display-value.d.ts +3 -3
  128. package/build/queries/display-value.js +9 -9
  129. package/build/queries/display-value.js.map +1 -1
  130. package/build/queries/hint-text.d.ts +4 -4
  131. package/build/queries/hint-text.js +9 -9
  132. package/build/queries/hint-text.js.map +1 -1
  133. package/build/queries/label-text.d.ts +4 -4
  134. package/build/queries/label-text.js +9 -9
  135. package/build/queries/label-text.js.map +1 -1
  136. package/build/queries/make-queries.d.ts +3 -3
  137. package/build/queries/make-queries.js +15 -18
  138. package/build/queries/make-queries.js.map +1 -1
  139. package/build/queries/options.d.ts +1 -1
  140. package/build/queries/options.js.map +1 -1
  141. package/build/queries/placeholder-text.d.ts +3 -3
  142. package/build/queries/placeholder-text.js +10 -10
  143. package/build/queries/placeholder-text.js.map +1 -1
  144. package/build/queries/role.d.ts +7 -7
  145. package/build/queries/role.js +16 -9
  146. package/build/queries/role.js.map +1 -1
  147. package/build/queries/test-id.d.ts +3 -3
  148. package/build/queries/test-id.js +9 -9
  149. package/build/queries/test-id.js.map +1 -1
  150. package/build/queries/text.d.ts +3 -3
  151. package/build/queries/text.js +9 -9
  152. package/build/queries/text.js.map +1 -1
  153. package/build/react-versions.js +1 -2
  154. package/build/react-versions.js.map +1 -1
  155. package/build/render-act.d.ts +3 -0
  156. package/build/render-act.js +29 -0
  157. package/build/render-act.js.map +1 -0
  158. package/build/render-async.d.ts +83 -0
  159. package/build/render-async.js +96 -0
  160. package/build/render-async.js.map +1 -0
  161. package/build/render-hook.d.ts +18 -6
  162. package/build/render-hook.js +56 -26
  163. package/build/render-hook.js.map +1 -1
  164. package/build/render.d.ts +54 -48
  165. package/build/render.js +42 -30
  166. package/build/render.js.map +1 -1
  167. package/build/screen.d.ts +1 -1
  168. package/build/screen.js +7 -7
  169. package/build/screen.js.map +1 -1
  170. package/build/test-utils/console.d.ts +1 -0
  171. package/build/test-utils/console.js +17 -0
  172. package/build/test-utils/console.js.map +1 -0
  173. package/build/test-utils/json.d.ts +6 -0
  174. package/build/test-utils/json.js +33 -0
  175. package/build/test-utils/json.js.map +1 -0
  176. package/build/tsconfig.release.tsbuildinfo +1 -1
  177. package/build/types.d.ts +4 -0
  178. package/build/types.js.map +1 -1
  179. package/build/user-event/clear.d.ts +2 -2
  180. package/build/user-event/clear.js +6 -6
  181. package/build/user-event/clear.js.map +1 -1
  182. package/build/user-event/event-builder/base.d.ts +2 -2
  183. package/build/user-event/event-builder/base.js.map +1 -1
  184. package/build/user-event/event-builder/scroll-view.d.ts +1 -1
  185. package/build/user-event/event-builder/scroll-view.js.map +1 -1
  186. package/build/user-event/event-builder/text-input.d.ts +2 -2
  187. package/build/user-event/event-builder/text-input.js.map +1 -1
  188. package/build/user-event/index.d.ts +4 -4
  189. package/build/user-event/index.js.map +1 -1
  190. package/build/user-event/paste.d.ts +2 -2
  191. package/build/user-event/paste.js +8 -8
  192. package/build/user-event/paste.js.map +1 -1
  193. package/build/user-event/press/index.d.ts +1 -1
  194. package/build/user-event/press/index.js.map +1 -1
  195. package/build/user-event/press/press.d.ts +2 -2
  196. package/build/user-event/press/press.js +48 -49
  197. package/build/user-event/press/press.js.map +1 -1
  198. package/build/user-event/scroll/index.d.ts +1 -1
  199. package/build/user-event/scroll/index.js.map +1 -1
  200. package/build/user-event/scroll/scroll-to.d.ts +3 -3
  201. package/build/user-event/scroll/scroll-to.js +8 -8
  202. package/build/user-event/scroll/scroll-to.js.map +1 -1
  203. package/build/user-event/scroll/utils.d.ts +1 -1
  204. package/build/user-event/scroll/utils.js.map +1 -1
  205. package/build/user-event/setup/setup.d.ts +4 -4
  206. package/build/user-event/setup/setup.js.map +1 -1
  207. package/build/user-event/type/type.d.ts +3 -2
  208. package/build/user-event/type/type.js +16 -14
  209. package/build/user-event/type/type.js.map +1 -1
  210. package/build/user-event/utils/content-size.d.ts +1 -1
  211. package/build/user-event/utils/content-size.js.map +1 -1
  212. package/build/user-event/utils/dispatch-event.d.ts +2 -2
  213. package/build/user-event/utils/dispatch-event.js +5 -15
  214. package/build/user-event/utils/dispatch-event.js.map +1 -1
  215. package/build/user-event/utils/wait.d.ts +6 -2
  216. package/build/user-event/utils/wait.js +1 -1
  217. package/build/user-event/utils/wait.js.map +1 -1
  218. package/build/wait-for-element-to-be-removed.js +1 -1
  219. package/build/wait-for-element-to-be-removed.js.map +1 -1
  220. package/build/wait-for.js +4 -5
  221. package/build/wait-for.js.map +1 -1
  222. package/build/within.d.ts +20 -20
  223. package/build/within.js +8 -8
  224. package/build/within.js.map +1 -1
  225. package/package.json +38 -32
  226. package/typings/index.flow.js +33 -36
  227. package/build/helpers/format-default.js.map +0 -1
  228. package/build/helpers/format.d.ts +0 -7
  229. package/build/helpers/format.js +0 -31
  230. package/build/helpers/format.js.map +0 -1
  231. package/build/test-utils/index.d.ts +0 -1
  232. package/build/test-utils/index.js +0 -17
  233. package/build/test-utils/index.js.map +0 -1
@@ -6,40 +6,43 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getContainerElement = getContainerElement;
7
7
  exports.getHostSiblings = getHostSiblings;
8
8
  exports.isElementMounted = isElementMounted;
9
- exports.isValidElement = isValidElement;
10
- var _universalTestRenderer = require("universal-test-renderer");
9
+ exports.isHostElement = isHostElement;
11
10
  var _screen = require("../screen");
12
11
  /**
13
12
  * Checks if the given element is a host element.
14
13
  * @param element The element to check.
15
14
  */
16
- function isValidElement(element) {
17
- return typeof element?.type === 'string' && element.type !== _universalTestRenderer.CONTAINER_TYPE;
15
+ function isHostElement(element) {
16
+ return typeof element !== 'string' && typeof element?.type === 'string';
18
17
  }
19
18
  function isElementMounted(element) {
20
19
  return getContainerElement(element) === _screen.screen.container;
21
20
  }
22
21
 
23
22
  /**
24
- * Returns the unsafe root element of the tree (probably composite).
25
- *
23
+ * Returns host siblings for given element.
26
24
  * @param element The element start traversing from.
27
- * @returns The root element of the tree (host or composite).
28
25
  */
29
- function getContainerElement(element) {
30
- let current = element;
31
- while (current?.parent) {
32
- current = current.parent;
26
+ function getHostSiblings(element) {
27
+ // Should not happen
28
+ const parent = element.parent;
29
+ if (!parent) {
30
+ return [];
33
31
  }
34
- return current;
32
+ return parent.children.filter(sibling => typeof sibling !== 'string' && sibling !== element);
35
33
  }
36
34
 
37
35
  /**
38
- * Returns host siblings for given element.
36
+ * Returns the containerelement of the tree.
37
+ *
39
38
  * @param element The element start traversing from.
39
+ * @returns The container element of the tree.
40
40
  */
41
- function getHostSiblings(element) {
42
- const hostParent = element?.parent ?? null;
43
- return hostParent?.children.filter(sibling => typeof sibling === 'object' && sibling !== element) ?? [];
41
+ function getContainerElement(element) {
42
+ let current = element;
43
+ while (current.parent) {
44
+ current = current.parent;
45
+ }
46
+ return current;
44
47
  }
45
48
  //# sourceMappingURL=component-tree.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"component-tree.js","names":["_universalTestRenderer","require","_screen","isValidElement","element","type","CONTAINER_TYPE","isElementMounted","getContainerElement","screen","container","current","parent","getHostSiblings","hostParent","children","filter","sibling"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import { CONTAINER_TYPE, HostElement } from 'universal-test-renderer';\nimport { screen } from '../screen';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isValidElement(element?: HostElement | null): element is HostElement {\n return typeof element?.type === 'string' && element.type !== CONTAINER_TYPE;\n}\n\nexport function isElementMounted(element: HostElement) {\n return getContainerElement(element) === screen.container;\n}\n\n/**\n * Returns the unsafe root element of the tree (probably composite).\n *\n * @param element The element start traversing from.\n * @returns The root element of the tree (host or composite).\n */\nexport function getContainerElement(element: HostElement) {\n let current: HostElement | null = element;\n while (current?.parent) {\n current = current.parent;\n }\n\n return current;\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(element: HostElement | null): HostElement[] {\n const hostParent = element?.parent ?? null;\n return (\n hostParent?.children.filter(\n (sibling): sibling is HostElement => typeof sibling === 'object' && sibling !== element,\n ) ?? []\n );\n}\n"],"mappings":";;;;;;;;;AAAA,IAAAA,sBAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASE,cAAcA,CAACC,OAA4B,EAA0B;EACnF,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAID,OAAO,CAACC,IAAI,KAAKC,qCAAc;AAC7E;AAEO,SAASC,gBAAgBA,CAACH,OAAoB,EAAE;EACrD,OAAOI,mBAAmB,CAACJ,OAAO,CAAC,KAAKK,cAAM,CAACC,SAAS;AAC1D;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASF,mBAAmBA,CAACJ,OAAoB,EAAE;EACxD,IAAIO,OAA2B,GAAGP,OAAO;EACzC,OAAOO,OAAO,EAAEC,MAAM,EAAE;IACtBD,OAAO,GAAGA,OAAO,CAACC,MAAM;EAC1B;EAEA,OAAOD,OAAO;AAChB;;AAEA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAACT,OAA2B,EAAiB;EAC1E,MAAMU,UAAU,GAAGV,OAAO,EAAEQ,MAAM,IAAI,IAAI;EAC1C,OACEE,UAAU,EAAEC,QAAQ,CAACC,MAAM,CACxBC,OAAO,IAA6B,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAKb,OAClF,CAAC,IAAI,EAAE;AAEX","ignoreList":[]}
1
+ {"version":3,"file":"component-tree.js","names":["_screen","require","isHostElement","element","type","isElementMounted","getContainerElement","screen","container","getHostSiblings","parent","children","filter","sibling","current"],"sources":["../../src/helpers/component-tree.ts"],"sourcesContent":["import type { HostElement, HostNode } from 'universal-test-renderer';\n\nimport { screen } from '../screen';\n\n/**\n * Checks if the given element is a host element.\n * @param element The element to check.\n */\nexport function isHostElement(element?: HostNode | null): element is HostElement {\n return typeof element !== 'string' && typeof element?.type === 'string';\n}\n\nexport function isElementMounted(element: HostElement) {\n return getContainerElement(element) === screen.container;\n}\n\n/**\n * Returns host siblings for given element.\n * @param element The element start traversing from.\n */\nexport function getHostSiblings(element: HostElement): HostElement[] {\n // Should not happen\n const parent = element.parent;\n if (!parent) {\n return [];\n }\n\n return parent.children.filter(\n (sibling) => typeof sibling !== 'string' && sibling !== element,\n ) as HostElement[];\n}\n\n/**\n * Returns the containerelement of the tree.\n *\n * @param element The element start traversing from.\n * @returns The container element of the tree.\n */\nexport function getContainerElement(element: HostElement) {\n let current = element;\n while (current.parent) {\n current = current.parent;\n }\n\n return current;\n}\n"],"mappings":";;;;;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACO,SAASC,aAAaA,CAACC,OAAyB,EAA0B;EAC/E,OAAO,OAAOA,OAAO,KAAK,QAAQ,IAAI,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ;AACzE;AAEO,SAASC,gBAAgBA,CAACF,OAAoB,EAAE;EACrD,OAAOG,mBAAmB,CAACH,OAAO,CAAC,KAAKI,cAAM,CAACC,SAAS;AAC1D;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACN,OAAoB,EAAiB;EACnE;EACA,MAAMO,MAAM,GAAGP,OAAO,CAACO,MAAM;EAC7B,IAAI,CAACA,MAAM,EAAE;IACX,OAAO,EAAE;EACX;EAEA,OAAOA,MAAM,CAACC,QAAQ,CAACC,MAAM,CAC1BC,OAAO,IAAK,OAAOA,OAAO,KAAK,QAAQ,IAAIA,OAAO,KAAKV,OAC1D,CAAC;AACH;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,mBAAmBA,CAACH,OAAoB,EAAE;EACxD,IAAIW,OAAO,GAAGX,OAAO;EACrB,OAAOW,OAAO,CAACJ,MAAM,EAAE;IACrBI,OAAO,GAAGA,OAAO,CAACJ,MAAM;EAC1B;EAEA,OAAOI,OAAO;AAChB","ignoreList":[]}
@@ -1,9 +1,9 @@
1
1
  import type { JsonNode } from 'universal-test-renderer';
2
- import { FormatOptions } from './format';
2
+ import type { FormatElementOptions } from './format-element';
3
3
  export type DebugOptions = {
4
4
  message?: string;
5
- } & FormatOptions;
5
+ } & FormatElementOptions;
6
6
  /**
7
7
  * Log pretty-printed deep test component instance
8
8
  */
9
- export declare function debug(instance: JsonNode | JsonNode[], options?: DebugOptions | string): void;
9
+ export declare function debug(node: JsonNode | JsonNode[], { message, ...formatOptions }?: DebugOptions): void;
@@ -4,22 +4,19 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.debug = debug;
7
- var _format = _interopRequireDefault(require("./format"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
7
+ var _formatElement = require("./format-element");
8
+ var _logger = require("./logger");
9
9
  /**
10
10
  * Log pretty-printed deep test component instance
11
11
  */
12
- function debug(instance, options) {
13
- const message = typeof options === 'string' ? options : options?.message;
14
- const formatOptions = typeof options === 'object' ? {
15
- mapProps: options?.mapProps
16
- } : undefined;
12
+ function debug(node, {
13
+ message,
14
+ ...formatOptions
15
+ } = {}) {
17
16
  if (message) {
18
- // eslint-disable-next-line no-console
19
- console.log(`${message}\n\n`, (0, _format.default)(instance, formatOptions));
17
+ _logger.logger.info(`${message}\n\n`, (0, _formatElement.formatJson)(node, formatOptions));
20
18
  } else {
21
- // eslint-disable-next-line no-console
22
- console.log((0, _format.default)(instance, formatOptions));
19
+ _logger.logger.info((0, _formatElement.formatJson)(node, formatOptions));
23
20
  }
24
21
  }
25
22
  //# sourceMappingURL=debug.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"debug.js","names":["_format","_interopRequireDefault","require","e","__esModule","default","debug","instance","options","message","formatOptions","mapProps","undefined","console","log","format"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\nimport format, { FormatOptions } from './format';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(instance: JsonNode | JsonNode[], options?: DebugOptions | string) {\n const message = typeof options === 'string' ? options : options?.message;\n\n const formatOptions = typeof options === 'object' ? { mapProps: options?.mapProps } : undefined;\n\n if (message) {\n // eslint-disable-next-line no-console\n console.log(`${message}\\n\\n`, format(instance, formatOptions));\n } else {\n // eslint-disable-next-line no-console\n console.log(format(instance, formatOptions));\n }\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAiD,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAMjD;AACA;AACA;AACO,SAASG,KAAKA,CAACC,QAA+B,EAAEC,OAA+B,EAAE;EACtF,MAAMC,OAAO,GAAG,OAAOD,OAAO,KAAK,QAAQ,GAAGA,OAAO,GAAGA,OAAO,EAAEC,OAAO;EAExE,MAAMC,aAAa,GAAG,OAAOF,OAAO,KAAK,QAAQ,GAAG;IAAEG,QAAQ,EAAEH,OAAO,EAAEG;EAAS,CAAC,GAAGC,SAAS;EAE/F,IAAIH,OAAO,EAAE;IACX;IACAI,OAAO,CAACC,GAAG,CAAC,GAAGL,OAAO,MAAM,EAAE,IAAAM,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACL;IACAG,OAAO,CAACC,GAAG,CAAC,IAAAC,eAAM,EAACR,QAAQ,EAAEG,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
1
+ {"version":3,"file":"debug.js","names":["_formatElement","require","_logger","debug","node","message","formatOptions","logger","info","formatJson"],"sources":["../../src/helpers/debug.ts"],"sourcesContent":["import type { JsonNode } from 'universal-test-renderer';\n\nimport type { FormatElementOptions } from './format-element';\nimport { formatJson } from './format-element';\nimport { logger } from './logger';\n\nexport type DebugOptions = {\n message?: string;\n} & FormatElementOptions;\n\n/**\n * Log pretty-printed deep test component instance\n */\nexport function debug(\n node: JsonNode | JsonNode[],\n { message, ...formatOptions }: DebugOptions = {},\n) {\n if (message) {\n logger.info(`${message}\\n\\n`, formatJson(node, formatOptions));\n } else {\n logger.info(formatJson(node, formatOptions));\n }\n}\n"],"mappings":";;;;;;AAGA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AAMA;AACA;AACA;AACO,SAASE,KAAKA,CACnBC,IAA2B,EAC3B;EAAEC,OAAO;EAAE,GAAGC;AAA4B,CAAC,GAAG,CAAC,CAAC,EAChD;EACA,IAAID,OAAO,EAAE;IACXE,cAAM,CAACC,IAAI,CAAC,GAAGH,OAAO,MAAM,EAAE,IAAAI,yBAAU,EAACL,IAAI,EAAEE,aAAa,CAAC,CAAC;EAChE,CAAC,MAAM;IACLC,cAAM,CAACC,IAAI,CAAC,IAAAC,yBAAU,EAACL,IAAI,EAAEE,aAAa,CAAC,CAAC;EAC9C;AACF","ignoreList":[]}
@@ -9,6 +9,7 @@ exports.prepareErrorMessage = exports.createQueryByError = void 0;
9
9
  var _prettyFormat = _interopRequireDefault(require("pretty-format"));
10
10
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
11
  class ErrorWithStack extends Error {
12
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
12
13
  constructor(message, callsite) {
13
14
  super(message);
14
15
  if (Error.captureStackTrace) {
@@ -34,6 +35,8 @@ const prepareErrorMessage = (error, name, value) => {
34
35
  }
35
36
  return errorMessage;
36
37
  };
38
+
39
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
37
40
  exports.prepareErrorMessage = prepareErrorMessage;
38
41
  const createQueryByError = (error, callsite) => {
39
42
  if (error instanceof Error) {
@@ -42,10 +45,7 @@ const createQueryByError = (error, callsite) => {
42
45
  }
43
46
  throw new ErrorWithStack(error.message, callsite);
44
47
  }
45
- throw new ErrorWithStack(
46
- // generic refining of `unknown` is very hard, you cannot do `'toString' in error` or anything like that
47
- // Converting as any with extra safe optional chaining will do the job just as well
48
- `Query: caught unknown error type: ${typeof error}, value: ${error?.toString?.()}`, callsite);
48
+ throw new ErrorWithStack(`Query: caught unknown error type: ${typeof error}, value: ${error}`, callsite);
49
49
  };
50
50
  exports.createQueryByError = createQueryByError;
51
51
  function copyStackTrace(target, stackTraceSource) {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","names":["_prettyFormat","_interopRequireDefault","require","e","__esModule","default","ErrorWithStack","Error","constructor","message","callsite","captureStackTrace","exports","prepareErrorMessage","error","name","value","errorMessage","replace","toString","prettyFormat","min","createQueryByError","includes","copyStackTrace","target","stackTraceSource","stack"],"sources":["../../src/helpers/errors.ts"],"sourcesContent":["import prettyFormat from 'pretty-format';\n\nexport class ErrorWithStack extends Error {\n constructor(message: string | undefined, callsite: Function) {\n super(message);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, callsite);\n }\n }\n}\n\nexport const prepareErrorMessage = (\n // TS states that error caught in a catch close are of type `unknown`\n // most real cases will be `Error`, but better safe than sorry\n error: unknown,\n name?: string,\n value?: unknown,\n): string => {\n let errorMessage: string;\n if (error instanceof Error) {\n // Strip info about custom predicate\n errorMessage = error.message.replace(/ matching custom predicate[^]*/gm, '');\n } else if (error && typeof error === 'object') {\n errorMessage = error.toString();\n } else {\n errorMessage = 'Caught unknown error';\n }\n\n if (name && value) {\n errorMessage += ` with ${name} ${prettyFormat(value, { min: true })}`;\n }\n return errorMessage;\n};\n\nexport const createQueryByError = (error: unknown, callsite: Function): null => {\n if (error instanceof Error) {\n if (error.message.includes('No instances found')) {\n return null;\n }\n throw new ErrorWithStack(error.message, callsite);\n }\n\n throw new ErrorWithStack(\n // generic refining of `unknown` is very hard, you cannot do `'toString' in error` or anything like that\n // Converting as any with extra safe optional chaining will do the job just as well\n `Query: caught unknown error type: ${typeof error}, value: ${(error as any)?.toString?.()}`,\n callsite,\n );\n};\n\nexport function copyStackTrace(target: unknown, stackTraceSource: Error) {\n if (target instanceof Error && stackTraceSource.stack) {\n target.stack = stackTraceSource.stack.replace(stackTraceSource.message, target.message);\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElC,MAAMG,cAAc,SAASC,KAAK,CAAC;EACxCC,WAAWA,CAACC,OAA2B,EAAEC,QAAkB,EAAE;IAC3D,KAAK,CAACD,OAAO,CAAC;IACd,IAAIF,KAAK,CAACI,iBAAiB,EAAE;MAC3BJ,KAAK,CAACI,iBAAiB,CAAC,IAAI,EAAED,QAAQ,CAAC;IACzC;EACF;AACF;AAACE,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAEM,MAAMO,mBAAmB,GAAGA,CAGjCC,KAAc,EACdC,IAAa,EACbC,KAAe,KACJ;EACX,IAAIC,YAAoB;EACxB,IAAIH,KAAK,YAAYP,KAAK,EAAE;IAC1B;IACAU,YAAY,GAAGH,KAAK,CAACL,OAAO,CAACS,OAAO,CAAC,kCAAkC,EAAE,EAAE,CAAC;EAC9E,CAAC,MAAM,IAAIJ,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7CG,YAAY,GAAGH,KAAK,CAACK,QAAQ,CAAC,CAAC;EACjC,CAAC,MAAM;IACLF,YAAY,GAAG,sBAAsB;EACvC;EAEA,IAAIF,IAAI,IAAIC,KAAK,EAAE;IACjBC,YAAY,IAAI,SAASF,IAAI,IAAI,IAAAK,qBAAY,EAACJ,KAAK,EAAE;MAAEK,GAAG,EAAE;IAAK,CAAC,CAAC,EAAE;EACvE;EACA,OAAOJ,YAAY;AACrB,CAAC;AAACL,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAEK,MAAMS,kBAAkB,GAAGA,CAACR,KAAc,EAAEJ,QAAkB,KAAW;EAC9E,IAAII,KAAK,YAAYP,KAAK,EAAE;IAC1B,IAAIO,KAAK,CAACL,OAAO,CAACc,QAAQ,CAAC,oBAAoB,CAAC,EAAE;MAChD,OAAO,IAAI;IACb;IACA,MAAM,IAAIjB,cAAc,CAACQ,KAAK,CAACL,OAAO,EAAEC,QAAQ,CAAC;EACnD;EAEA,MAAM,IAAIJ,cAAc;EACtB;EACA;EACA,qCAAqC,OAAOQ,KAAK,YAAaA,KAAK,EAAUK,QAAQ,GAAG,CAAC,EAAE,EAC3FT,QACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAU,kBAAA,GAAAA,kBAAA;AAEK,SAASE,cAAcA,CAACC,MAAe,EAAEC,gBAAuB,EAAE;EACvE,IAAID,MAAM,YAAYlB,KAAK,IAAImB,gBAAgB,CAACC,KAAK,EAAE;IACrDF,MAAM,CAACE,KAAK,GAAGD,gBAAgB,CAACC,KAAK,CAACT,OAAO,CAACQ,gBAAgB,CAACjB,OAAO,EAAEgB,MAAM,CAAChB,OAAO,CAAC;EACzF;AACF","ignoreList":[]}
1
+ {"version":3,"file":"errors.js","names":["_prettyFormat","_interopRequireDefault","require","e","__esModule","default","ErrorWithStack","Error","constructor","message","callsite","captureStackTrace","exports","prepareErrorMessage","error","name","value","errorMessage","replace","toString","prettyFormat","min","createQueryByError","includes","copyStackTrace","target","stackTraceSource","stack"],"sources":["../../src/helpers/errors.ts"],"sourcesContent":["import prettyFormat from 'pretty-format';\n\nexport class ErrorWithStack extends Error {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\n constructor(message: string | undefined, callsite: Function) {\n super(message);\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, callsite);\n }\n }\n}\n\nexport const prepareErrorMessage = (\n // TS states that error caught in a catch close are of type `unknown`\n // most real cases will be `Error`, but better safe than sorry\n error: unknown,\n name?: string,\n value?: unknown,\n): string => {\n let errorMessage: string;\n if (error instanceof Error) {\n // Strip info about custom predicate\n errorMessage = error.message.replace(/ matching custom predicate[^]*/gm, '');\n } else if (error && typeof error === 'object') {\n errorMessage = error.toString();\n } else {\n errorMessage = 'Caught unknown error';\n }\n\n if (name && value) {\n errorMessage += ` with ${name} ${prettyFormat(value, { min: true })}`;\n }\n return errorMessage;\n};\n\n// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type\nexport const createQueryByError = (error: unknown, callsite: Function): null => {\n if (error instanceof Error) {\n if (error.message.includes('No instances found')) {\n return null;\n }\n throw new ErrorWithStack(error.message, callsite);\n }\n\n throw new ErrorWithStack(\n `Query: caught unknown error type: ${typeof error}, value: ${error}`,\n callsite,\n );\n};\n\nexport function copyStackTrace(target: unknown, stackTraceSource: Error) {\n if (target instanceof Error && stackTraceSource.stack) {\n target.stack = stackTraceSource.stack.replace(stackTraceSource.message, target.message);\n }\n}\n"],"mappings":";;;;;;;;AAAA,IAAAA,aAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyC,SAAAD,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAElC,MAAMG,cAAc,SAASC,KAAK,CAAC;EACxC;EACAC,WAAWA,CAACC,OAA2B,EAAEC,QAAkB,EAAE;IAC3D,KAAK,CAACD,OAAO,CAAC;IACd,IAAIF,KAAK,CAACI,iBAAiB,EAAE;MAC3BJ,KAAK,CAACI,iBAAiB,CAAC,IAAI,EAAED,QAAQ,CAAC;IACzC;EACF;AACF;AAACE,OAAA,CAAAN,cAAA,GAAAA,cAAA;AAEM,MAAMO,mBAAmB,GAAGA,CAGjCC,KAAc,EACdC,IAAa,EACbC,KAAe,KACJ;EACX,IAAIC,YAAoB;EACxB,IAAIH,KAAK,YAAYP,KAAK,EAAE;IAC1B;IACAU,YAAY,GAAGH,KAAK,CAACL,OAAO,CAACS,OAAO,CAAC,kCAAkC,EAAE,EAAE,CAAC;EAC9E,CAAC,MAAM,IAAIJ,KAAK,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC7CG,YAAY,GAAGH,KAAK,CAACK,QAAQ,CAAC,CAAC;EACjC,CAAC,MAAM;IACLF,YAAY,GAAG,sBAAsB;EACvC;EAEA,IAAIF,IAAI,IAAIC,KAAK,EAAE;IACjBC,YAAY,IAAI,SAASF,IAAI,IAAI,IAAAK,qBAAY,EAACJ,KAAK,EAAE;MAAEK,GAAG,EAAE;IAAK,CAAC,CAAC,EAAE;EACvE;EACA,OAAOJ,YAAY;AACrB,CAAC;;AAED;AAAAL,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AACO,MAAMS,kBAAkB,GAAGA,CAACR,KAAc,EAAEJ,QAAkB,KAAW;EAC9E,IAAII,KAAK,YAAYP,KAAK,EAAE;IAC1B,IAAIO,KAAK,CAACL,OAAO,CAACc,QAAQ,CAAC,oBAAoB,CAAC,EAAE;MAChD,OAAO,IAAI;IACb;IACA,MAAM,IAAIjB,cAAc,CAACQ,KAAK,CAACL,OAAO,EAAEC,QAAQ,CAAC;EACnD;EAEA,MAAM,IAAIJ,cAAc,CACtB,qCAAqC,OAAOQ,KAAK,YAAYA,KAAK,EAAE,EACpEJ,QACF,CAAC;AACH,CAAC;AAACE,OAAA,CAAAU,kBAAA,GAAAA,kBAAA;AAEK,SAASE,cAAcA,CAACC,MAAe,EAAEC,gBAAuB,EAAE;EACvE,IAAID,MAAM,YAAYlB,KAAK,IAAImB,gBAAgB,CAACC,KAAK,EAAE;IACrDF,MAAM,CAACE,KAAK,GAAGD,gBAAgB,CAACC,KAAK,CAACT,OAAO,CAACQ,gBAAgB,CAACjB,OAAO,EAAEgB,MAAM,CAAChB,OAAO,CAAC;EACzF;AACF","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  interface FindAllOptions {
3
3
  /** Match elements hidden from accessibility */
4
4
  includeHiddenElements?: boolean;
@@ -6,9 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.findAll = findAll;
7
7
  var _config = require("../config");
8
8
  var _accessibility = require("./accessibility");
9
- var _componentTree = require("./component-tree");
10
- function findAll(root, predicate, options) {
11
- const results = findAllInternal(root, predicate, options);
9
+ function findAll(root, predicate, options = {}) {
10
+ const {
11
+ matchDeepestOnly
12
+ } = options;
13
+ const results = root.queryAll(predicate, {
14
+ matchDeepestOnly
15
+ });
12
16
  const includeHiddenElements = options?.includeHiddenElements ?? options?.hidden ?? (0, _config.getConfig)()?.defaultIncludeHiddenElements;
13
17
  if (includeHiddenElements) {
14
18
  return results;
@@ -18,28 +22,4 @@ function findAll(root, predicate, options) {
18
22
  cache
19
23
  }));
20
24
  }
21
-
22
- // Extracted from React Test Renderer
23
- // src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402
24
- function findAllInternal(node, predicate, options, indent = '') {
25
- const results = [];
26
-
27
- // Match descendants first but do not add them to results yet.
28
- const matchingDescendants = [];
29
- node.children.forEach(child => {
30
- if (typeof child === 'string') {
31
- return;
32
- }
33
- matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));
34
- });
35
- if (
36
- // When matchDeepestOnly = true: add current element only if no descendants match
37
- (!options?.matchDeepestOnly || matchingDescendants.length === 0) && (0, _componentTree.isValidElement)(node) && predicate(node)) {
38
- results.push(node);
39
- }
40
-
41
- // Add matching descendants after element to preserve original tree walk order.
42
- results.push(...matchingDescendants);
43
- return results;
44
- }
45
25
  //# sourceMappingURL=find-all.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"find-all.js","names":["_config","require","_accessibility","_componentTree","findAll","root","predicate","options","results","findAllInternal","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility","node","indent","matchingDescendants","children","forEach","child","push","matchDeepestOnly","length","isValidElement"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessibility';\nimport { isValidElement } from './component-tree';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: FindAllOptions,\n): HostElement[] {\n const results = findAllInternal(root, predicate, options);\n\n const includeHiddenElements =\n options?.includeHiddenElements ?? options?.hidden ?? getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<HostElement>();\n return results.filter((element) => !isHiddenFromAccessibility(element, { cache }));\n}\n\n// Extracted from React Test Renderer\n// src: https://github.com/facebook/react/blob/8e2bde6f2751aa6335f3cef488c05c3ea08e074a/packages/react-test-renderer/src/ReactTestRenderer.js#L402\nfunction findAllInternal(\n node: HostElement,\n predicate: (element: HostElement) => boolean,\n options?: FindAllOptions,\n indent: string = '',\n): HostElement[] {\n const results: HostElement[] = [];\n\n // Match descendants first but do not add them to results yet.\n const matchingDescendants: HostElement[] = [];\n node.children.forEach((child) => {\n if (typeof child === 'string') {\n return;\n }\n matchingDescendants.push(...findAllInternal(child, predicate, options, indent + ' '));\n });\n\n if (\n // When matchDeepestOnly = true: add current element only if no descendants match\n (!options?.matchDeepestOnly || matchingDescendants.length === 0) &&\n isValidElement(node) &&\n predicate(node)\n ) {\n results.push(node);\n }\n\n // Add matching descendants after element to preserve original tree walk order.\n results.push(...matchingDescendants);\n\n return results;\n}\n"],"mappings":";;;;;;AACA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AACA,IAAAE,cAAA,GAAAF,OAAA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b,OAAO;AAChB","ignoreList":[]}
1
+ {"version":3,"file":"find-all.js","names":["_config","require","_accessibility","findAll","root","predicate","options","matchDeepestOnly","results","queryAll","includeHiddenElements","hidden","getConfig","defaultIncludeHiddenElements","cache","WeakMap","filter","element","isHiddenFromAccessibility"],"sources":["../../src/helpers/find-all.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport { getConfig } from '../config';\nimport { isHiddenFromAccessibility } from './accessibility';\n\ninterface FindAllOptions {\n /** Match elements hidden from accessibility */\n includeHiddenElements?: boolean;\n\n /** RTL-compatible alias to `includeHiddenElements` */\n hidden?: boolean;\n\n /* Exclude any ancestors of deepest matched elements even if they match the predicate */\n matchDeepestOnly?: boolean;\n}\n\nexport function findAll(\n root: HostElement,\n predicate: (element: HostElement) => boolean,\n options: FindAllOptions = {},\n): HostElement[] {\n const { matchDeepestOnly } = options;\n const results = root.queryAll(predicate, { matchDeepestOnly });\n\n const includeHiddenElements =\n options?.includeHiddenElements ?? options?.hidden ?? getConfig()?.defaultIncludeHiddenElements;\n\n if (includeHiddenElements) {\n return results;\n }\n\n const cache = new WeakMap<HostElement>();\n return results.filter((element) => !isHiddenFromAccessibility(element, { cache }));\n}\n"],"mappings":";;;;;;AAEA,IAAAA,OAAA,GAAAC,OAAA;AACA,IAAAC,cAAA,GAAAD,OAAA;AAaO,SAASE,OAAOA,CACrBC,IAAiB,EACjBC,SAA4C,EAC5CC,OAAuB,GAAG,CAAC,CAAC,EACb;EACf,MAAM;IAAEC;EAAiB,CAAC,GAAGD,OAAO;EACpC,MAAME,OAAO,GAAGJ,IAAI,CAACK,QAAQ,CAACJ,SAAS,EAAE;IAAEE;EAAiB,CAAC,CAAC;EAE9D,MAAMG,qBAAqB,GACzBJ,OAAO,EAAEI,qBAAqB,IAAIJ,OAAO,EAAEK,MAAM,IAAI,IAAAC,iBAAS,EAAC,CAAC,EAAEC,4BAA4B;EAEhG,IAAIH,qBAAqB,EAAE;IACzB,OAAOF,OAAO;EAChB;EAEA,MAAMM,KAAK,GAAG,IAAIC,OAAO,CAAc,CAAC;EACxC,OAAOP,OAAO,CAACQ,MAAM,CAAEC,OAAO,IAAK,CAAC,IAAAC,wCAAyB,EAACD,OAAO,EAAE;IAAEH;EAAM,CAAC,CAAC,CAAC;AACpF","ignoreList":[]}
@@ -0,0 +1,18 @@
1
+ import type { HostElement, JsonNode } from 'universal-test-renderer';
2
+ import type { MapPropsFunction } from './map-props';
3
+ export type FormatElementOptions = {
4
+ /** Minimize used space. */
5
+ compact?: boolean;
6
+ /** Highlight the output. */
7
+ highlight?: boolean;
8
+ /** Filter or map props to display. */
9
+ mapProps?: MapPropsFunction | null;
10
+ };
11
+ /***
12
+ * Format given element as a pretty-printed string.
13
+ *
14
+ * @param element Element to format.
15
+ */
16
+ export declare function formatElement(element: HostElement | null, { compact, highlight, mapProps }?: FormatElementOptions): string;
17
+ export declare function formatElementList(elements: HostElement[], options?: FormatElementOptions): string;
18
+ export declare function formatJson(json: JsonNode | JsonNode[], { compact, highlight, mapProps }?: FormatElementOptions): string;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.formatElement = formatElement;
7
+ exports.formatElementList = formatElementList;
8
+ exports.formatJson = formatJson;
9
+ var _prettyFormat = _interopRequireWildcard(require("pretty-format"));
10
+ var _mapProps = require("./map-props");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /***
13
+ * Format given element as a pretty-printed string.
14
+ *
15
+ * @param element Element to format.
16
+ */
17
+ function formatElement(element, {
18
+ compact,
19
+ highlight = true,
20
+ mapProps = _mapProps.defaultMapProps
21
+ } = {}) {
22
+ if (element == null) {
23
+ return '(null)';
24
+ }
25
+ const {
26
+ children,
27
+ ...props
28
+ } = element.props;
29
+ const childrenToDisplay = typeof children === 'string' ? [children] : undefined;
30
+ return (0, _prettyFormat.default)({
31
+ // This prop is needed persuade the prettyFormat that the element is
32
+ // a JsonNode instance, so it is formatted as JSX.
33
+ $$typeof: Symbol.for('react.test.json'),
34
+ type: `${element.type}`,
35
+ props: mapProps ? mapProps(props) : props,
36
+ children: childrenToDisplay
37
+ },
38
+ // See: https://www.npmjs.com/package/pretty-format#usage-with-options
39
+ {
40
+ plugins: [_prettyFormat.plugins.ReactTestComponent, _prettyFormat.plugins.ReactElement],
41
+ printFunctionName: false,
42
+ printBasicPrototype: false,
43
+ highlight: highlight,
44
+ min: compact
45
+ });
46
+ }
47
+ function formatElementList(elements, options) {
48
+ if (elements.length === 0) {
49
+ return '(no elements)';
50
+ }
51
+ return elements.map(element => formatElement(element, options)).join('\n');
52
+ }
53
+ function formatJson(json, {
54
+ compact,
55
+ highlight = true,
56
+ mapProps = _mapProps.defaultMapProps
57
+ } = {}) {
58
+ return (0, _prettyFormat.default)(json, {
59
+ plugins: [getElementJsonPlugin(mapProps), _prettyFormat.plugins.ReactElement],
60
+ highlight: highlight,
61
+ printBasicPrototype: false,
62
+ min: compact
63
+ });
64
+ }
65
+ function getElementJsonPlugin(mapProps) {
66
+ return {
67
+ test: val => _prettyFormat.plugins.ReactTestComponent.test(val),
68
+ serialize: (val, config, indentation, depth, refs, printer) => {
69
+ let newVal = val;
70
+ if (mapProps && val.props) {
71
+ newVal = {
72
+ ...val,
73
+ props: mapProps(val.props)
74
+ };
75
+ }
76
+ return _prettyFormat.plugins.ReactTestComponent.serialize(newVal, config, indentation, depth, refs, printer);
77
+ }
78
+ };
79
+ }
80
+ //# sourceMappingURL=format-element.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format-element.js","names":["_prettyFormat","_interopRequireWildcard","require","_mapProps","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","formatElement","element","compact","highlight","mapProps","defaultMapProps","children","props","childrenToDisplay","undefined","prettyFormat","$$typeof","Symbol","for","type","plugins","ReactTestComponent","ReactElement","printFunctionName","printBasicPrototype","min","formatElementList","elements","options","length","map","join","formatJson","json","getElementJsonPlugin","test","val","serialize","config","indentation","depth","refs","printer","newVal"],"sources":["../../src/helpers/format-element.ts"],"sourcesContent":["import type { NewPlugin } from 'pretty-format';\nimport prettyFormat, { plugins } from 'pretty-format';\nimport type { HostElement, JsonNode } from 'universal-test-renderer';\n\nimport type { MapPropsFunction } from './map-props';\nimport { defaultMapProps } from './map-props';\n\nexport type FormatElementOptions = {\n /** Minimize used space. */\n compact?: boolean;\n\n /** Highlight the output. */\n highlight?: boolean;\n\n /** Filter or map props to display. */\n mapProps?: MapPropsFunction | null;\n};\n\n/***\n * Format given element as a pretty-printed string.\n *\n * @param element Element to format.\n */\nexport function formatElement(\n element: HostElement | null,\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n if (element == null) {\n return '(null)';\n }\n\n const { children, ...props } = element.props;\n const childrenToDisplay = typeof children === 'string' ? [children] : undefined;\n\n return prettyFormat(\n {\n // This prop is needed persuade the prettyFormat that the element is\n // a JsonNode instance, so it is formatted as JSX.\n $$typeof: Symbol.for('react.test.json'),\n type: `${element.type}`,\n props: mapProps ? mapProps(props) : props,\n children: childrenToDisplay,\n },\n // See: https://www.npmjs.com/package/pretty-format#usage-with-options\n {\n plugins: [plugins.ReactTestComponent, plugins.ReactElement],\n printFunctionName: false,\n printBasicPrototype: false,\n highlight: highlight,\n min: compact,\n },\n );\n}\n\nexport function formatElementList(elements: HostElement[], options?: FormatElementOptions) {\n if (elements.length === 0) {\n return '(no elements)';\n }\n\n return elements.map((element) => formatElement(element, options)).join('\\n');\n}\n\nexport function formatJson(\n json: JsonNode | JsonNode[],\n { compact, highlight = true, mapProps = defaultMapProps }: FormatElementOptions = {},\n) {\n return prettyFormat(json, {\n plugins: [getElementJsonPlugin(mapProps), plugins.ReactElement],\n highlight: highlight,\n printBasicPrototype: false,\n min: compact,\n });\n}\n\nfunction getElementJsonPlugin(mapProps?: MapPropsFunction | null): NewPlugin {\n return {\n test: (val) => plugins.ReactTestComponent.test(val),\n serialize: (val, config, indentation, depth, refs, printer) => {\n let newVal = val;\n if (mapProps && val.props) {\n newVal = { ...val, props: mapProps(val.props) };\n }\n return plugins.ReactTestComponent.serialize(\n newVal,\n config,\n indentation,\n depth,\n refs,\n printer,\n );\n },\n };\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,aAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,SAAA,GAAAD,OAAA;AAA8C,SAAAD,wBAAAG,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAL,uBAAA,YAAAA,CAAAG,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAA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HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  /**
3
3
  * Checks if the given element is a host Text element.
4
4
  * @param element The element to check.
@@ -9,7 +9,6 @@ exports.isHostScrollView = isHostScrollView;
9
9
  exports.isHostSwitch = isHostSwitch;
10
10
  exports.isHostText = isHostText;
11
11
  exports.isHostTextInput = isHostTextInput;
12
- var _componentTree = require("./component-tree");
13
12
  const HOST_TEXT_NAMES = ['Text', 'RCTText'];
14
13
  const HOST_TEXT_INPUT_NAMES = ['TextInput'];
15
14
  const HOST_IMAGE_NAMES = ['Image'];
@@ -22,7 +21,7 @@ const HOST_MODAL_NAMES = ['Modal'];
22
21
  * @param element The element to check.
23
22
  */
24
23
  function isHostText(element) {
25
- return (0, _componentTree.isValidElement)(element) && HOST_TEXT_NAMES.includes(element.type);
24
+ return typeof element?.type === 'string' && HOST_TEXT_NAMES.includes(element.type);
26
25
  }
27
26
 
28
27
  /**
@@ -30,7 +29,7 @@ function isHostText(element) {
30
29
  * @param element The element to check.
31
30
  */
32
31
  function isHostTextInput(element) {
33
- return (0, _componentTree.isValidElement)(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);
32
+ return typeof element?.type === 'string' && HOST_TEXT_INPUT_NAMES.includes(element.type);
34
33
  }
35
34
 
36
35
  /**
@@ -38,7 +37,7 @@ function isHostTextInput(element) {
38
37
  * @param element The element to check.
39
38
  */
40
39
  function isHostImage(element) {
41
- return (0, _componentTree.isValidElement)(element) && HOST_IMAGE_NAMES.includes(element.type);
40
+ return typeof element?.type === 'string' && HOST_IMAGE_NAMES.includes(element.type);
42
41
  }
43
42
 
44
43
  /**
@@ -46,7 +45,7 @@ function isHostImage(element) {
46
45
  * @param element The element to check.
47
46
  */
48
47
  function isHostSwitch(element) {
49
- return (0, _componentTree.isValidElement)(element) && HOST_SWITCH_NAMES.includes(element.type);
48
+ return typeof element?.type === 'string' && HOST_SWITCH_NAMES.includes(element.type);
50
49
  }
51
50
 
52
51
  /**
@@ -54,7 +53,7 @@ function isHostSwitch(element) {
54
53
  * @param element The element to check.
55
54
  */
56
55
  function isHostScrollView(element) {
57
- return (0, _componentTree.isValidElement)(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);
56
+ return typeof element?.type === 'string' && HOST_SCROLL_VIEW_NAMES.includes(element.type);
58
57
  }
59
58
 
60
59
  /**
@@ -62,6 +61,6 @@ function isHostScrollView(element) {
62
61
  * @param element The element to check.
63
62
  */
64
63
  function isHostModal(element) {
65
- return (0, _componentTree.isValidElement)(element) && HOST_MODAL_NAMES.includes(element.type);
64
+ return typeof element?.type === 'string' && HOST_MODAL_NAMES.includes(element.type);
66
65
  }
67
66
  //# sourceMappingURL=host-component-names.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"host-component-names.js","names":["_componentTree","require","HOST_TEXT_NAMES","HOST_TEXT_INPUT_NAMES","HOST_IMAGE_NAMES","HOST_SWITCH_NAMES","HOST_SCROLL_VIEW_NAMES","HOST_MODAL_NAMES","isHostText","element","isValidElement","includes","type","isHostTextInput","isHostImage","isHostSwitch","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport { isValidElement } from './component-tree';\n\nconst HOST_TEXT_NAMES = ['Text', 'RCTText'];\nconst HOST_TEXT_INPUT_NAMES = ['TextInput'];\nconst HOST_IMAGE_NAMES = ['Image'];\nconst HOST_SWITCH_NAMES = ['RCTSwitch'];\nconst HOST_SCROLL_VIEW_NAMES = ['RCTScrollView'];\nconst HOST_MODAL_NAMES = ['Modal'];\n\n/**\n * Checks if the given element is a host Text element.\n * @param element The element to check.\n */\nexport function isHostText(element: HostElement | null) {\n return isValidElement(element) && HOST_TEXT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host TextInput element.\n * @param element The element to check.\n */\nexport function isHostTextInput(element: HostElement | null) {\n return isValidElement(element) && HOST_TEXT_INPUT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Image element.\n * @param element The element to check.\n */\nexport function isHostImage(element: HostElement | null) {\n return isValidElement(element) && HOST_IMAGE_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Switch element.\n * @param element The element to check.\n */\nexport function isHostSwitch(element: HostElement | null) {\n return isValidElement(element) && HOST_SWITCH_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host ScrollView element.\n * @param element The element to check.\n */\nexport function isHostScrollView(element: HostElement | null) {\n return isValidElement(element) && HOST_SCROLL_VIEW_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Modal element.\n * @param element The element to check.\n */\nexport function isHostModal(element: HostElement | null) {\n return isValidElement(element) && HOST_MODAL_NAMES.includes(element.type);\n}\n"],"mappings":";;;;;;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAEA,MAAMC,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAC3C,MAAMC,qBAAqB,GAAG,CAAC,WAAW,CAAC;AAC3C,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;AAClC,MAAMC,iBAAiB,GAAG,CAAC,WAAW,CAAC;AACvC,MAAMC,sBAAsB,GAAG,CAAC,eAAe,CAAC;AAChD,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;;AAElC;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,OAA2B,EAAE;EACtD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIP,eAAe,CAACS,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC1E;;AAEA;AACA;AACA;AACA;AACO,SAASC,eAAeA,CAACJ,OAA2B,EAAE;EAC3D,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIN,qBAAqB,CAACQ,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAChF;;AAEA;AACA;AACA;AACA;AACO,SAASE,WAAWA,CAACL,OAA2B,EAAE;EACvD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIL,gBAAgB,CAACO,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E;;AAEA;AACA;AACA;AACA;AACO,SAASG,YAAYA,CAACN,OAA2B,EAAE;EACxD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIJ,iBAAiB,CAACM,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC5E;;AAEA;AACA;AACA;AACA;AACO,SAASI,gBAAgBA,CAACP,OAA2B,EAAE;EAC5D,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIH,sBAAsB,CAACK,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AACjF;;AAEA;AACA;AACA;AACA;AACO,SAASK,WAAWA,CAACR,OAA2B,EAAE;EACvD,OAAO,IAAAC,6BAAc,EAACD,OAAO,CAAC,IAAIF,gBAAgB,CAACI,QAAQ,CAACF,OAAO,CAACG,IAAI,CAAC;AAC3E","ignoreList":[]}
1
+ {"version":3,"file":"host-component-names.js","names":["HOST_TEXT_NAMES","HOST_TEXT_INPUT_NAMES","HOST_IMAGE_NAMES","HOST_SWITCH_NAMES","HOST_SCROLL_VIEW_NAMES","HOST_MODAL_NAMES","isHostText","element","type","includes","isHostTextInput","isHostImage","isHostSwitch","isHostScrollView","isHostModal"],"sources":["../../src/helpers/host-component-names.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nconst HOST_TEXT_NAMES = ['Text', 'RCTText'];\nconst HOST_TEXT_INPUT_NAMES = ['TextInput'];\nconst HOST_IMAGE_NAMES = ['Image'];\nconst HOST_SWITCH_NAMES = ['RCTSwitch'];\nconst HOST_SCROLL_VIEW_NAMES = ['RCTScrollView'];\nconst HOST_MODAL_NAMES = ['Modal'];\n\n/**\n * Checks if the given element is a host Text element.\n * @param element The element to check.\n */\nexport function isHostText(element: HostElement | null) {\n return typeof element?.type === 'string' && HOST_TEXT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host TextInput element.\n * @param element The element to check.\n */\nexport function isHostTextInput(element: HostElement | null) {\n return typeof element?.type === 'string' && HOST_TEXT_INPUT_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Image element.\n * @param element The element to check.\n */\nexport function isHostImage(element: HostElement | null) {\n return typeof element?.type === 'string' && HOST_IMAGE_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Switch element.\n * @param element The element to check.\n */\nexport function isHostSwitch(element: HostElement | null) {\n return typeof element?.type === 'string' && HOST_SWITCH_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host ScrollView element.\n * @param element The element to check.\n */\nexport function isHostScrollView(element: HostElement | null) {\n return typeof element?.type === 'string' && HOST_SCROLL_VIEW_NAMES.includes(element.type);\n}\n\n/**\n * Checks if the given element is a host Modal element.\n * @param element The element to check.\n */\nexport function isHostModal(element: HostElement | null) {\n return typeof element?.type === 'string' && HOST_MODAL_NAMES.includes(element.type);\n}\n"],"mappings":";;;;;;;;;;;AAEA,MAAMA,eAAe,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC;AAC3C,MAAMC,qBAAqB,GAAG,CAAC,WAAW,CAAC;AAC3C,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;AAClC,MAAMC,iBAAiB,GAAG,CAAC,WAAW,CAAC;AACvC,MAAMC,sBAAsB,GAAG,CAAC,eAAe,CAAC;AAChD,MAAMC,gBAAgB,GAAG,CAAC,OAAO,CAAC;;AAElC;AACA;AACA;AACA;AACO,SAASC,UAAUA,CAACC,OAA2B,EAAE;EACtD,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIR,eAAe,CAACS,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACpF;;AAEA;AACA;AACA;AACA;AACO,SAASE,eAAeA,CAACH,OAA2B,EAAE;EAC3D,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIP,qBAAqB,CAACQ,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AAC1F;;AAEA;AACA;AACA;AACA;AACO,SAASG,WAAWA,CAACJ,OAA2B,EAAE;EACvD,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIN,gBAAgB,CAACO,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACrF;;AAEA;AACA;AACA;AACA;AACO,SAASI,YAAYA,CAACL,OAA2B,EAAE;EACxD,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIL,iBAAiB,CAACM,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACtF;;AAEA;AACA;AACA;AACA;AACO,SAASK,gBAAgBA,CAACN,OAA2B,EAAE;EAC5D,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIJ,sBAAsB,CAACK,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AAC3F;;AAEA;AACA;AACA;AACA;AACO,SAASM,WAAWA,CAACP,OAA2B,EAAE;EACvD,OAAO,OAAOA,OAAO,EAAEC,IAAI,KAAK,QAAQ,IAAIH,gBAAgB,CAACI,QAAQ,CAACF,OAAO,CAACC,IAAI,CAAC;AACrF","ignoreList":[]}
@@ -0,0 +1,28 @@
1
+ export declare const _console: {
2
+ debug: {
3
+ (...data: any[]): void;
4
+ (message?: any, ...optionalParams: any[]): void;
5
+ (message?: any, ...optionalParams: any[]): void;
6
+ };
7
+ info: {
8
+ (...data: any[]): void;
9
+ (message?: any, ...optionalParams: any[]): void;
10
+ (message?: any, ...optionalParams: any[]): void;
11
+ };
12
+ warn: {
13
+ (...data: any[]): void;
14
+ (message?: any, ...optionalParams: any[]): void;
15
+ (message?: any, ...optionalParams: any[]): void;
16
+ };
17
+ error: {
18
+ (...data: any[]): void;
19
+ (message?: any, ...optionalParams: any[]): void;
20
+ (message?: any, ...optionalParams: any[]): void;
21
+ };
22
+ };
23
+ export declare const logger: {
24
+ debug(message: unknown, ...args: unknown[]): void;
25
+ info(message: unknown, ...args: unknown[]): void;
26
+ warn(message: unknown, ...args: unknown[]): void;
27
+ error(message: unknown, ...args: unknown[]): void;
28
+ };
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.logger = exports._console = void 0;
7
+ var nodeConsole = _interopRequireWildcard(require("console"));
8
+ var _picocolors = _interopRequireDefault(require("picocolors"));
9
+ var _redent = _interopRequireDefault(require("redent"));
10
+ var nodeUtil = _interopRequireWildcard(require("util"));
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ const _console = exports._console = {
14
+ debug: nodeConsole.debug,
15
+ info: nodeConsole.info,
16
+ warn: nodeConsole.warn,
17
+ error: nodeConsole.error
18
+ };
19
+ const logger = exports.logger = {
20
+ debug(message, ...args) {
21
+ const output = formatMessage('●', message, ...args);
22
+ _console.debug(_picocolors.default.dim(output));
23
+ },
24
+ info(message, ...args) {
25
+ const output = formatMessage('●', message, ...args);
26
+ _console.info(output);
27
+ },
28
+ warn(message, ...args) {
29
+ const output = formatMessage('▲', message, ...args);
30
+ _console.warn(_picocolors.default.yellow(output));
31
+ },
32
+ error(message, ...args) {
33
+ const output = formatMessage('■', message, ...args);
34
+ _console.error(_picocolors.default.red(output));
35
+ }
36
+ };
37
+ function formatMessage(symbol, message, ...args) {
38
+ const formatted = nodeUtil.format(message, ...args);
39
+ const indented = (0, _redent.default)(formatted, 4);
40
+ return ` ${symbol} ${indented.trimStart()}\n`;
41
+ }
42
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","names":["nodeConsole","_interopRequireWildcard","require","_picocolors","_interopRequireDefault","_redent","nodeUtil","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","_console","exports","debug","info","warn","error","logger","message","args","output","formatMessage","pc","dim","yellow","red","symbol","formatted","format","indented","redent","trimStart"],"sources":["../../src/helpers/logger.ts"],"sourcesContent":["import * as nodeConsole from 'console';\nimport pc from 'picocolors';\nimport redent from 'redent';\nimport * as nodeUtil from 'util';\n\nexport const _console = {\n debug: nodeConsole.debug,\n info: nodeConsole.info,\n warn: nodeConsole.warn,\n error: nodeConsole.error,\n};\n\nexport const logger = {\n debug(message: unknown, ...args: unknown[]) {\n const output = formatMessage('●', message, ...args);\n _console.debug(pc.dim(output));\n },\n\n info(message: unknown, ...args: unknown[]) {\n const output = formatMessage('●', message, ...args);\n _console.info(output);\n },\n\n warn(message: unknown, ...args: unknown[]) {\n const output = formatMessage('▲', message, ...args);\n _console.warn(pc.yellow(output));\n },\n\n error(message: unknown, ...args: unknown[]) {\n const output = formatMessage('■', message, ...args);\n _console.error(pc.red(output));\n },\n};\n\nfunction formatMessage(symbol: string, message: unknown, ...args: unknown[]) {\n const formatted = nodeUtil.format(message, ...args);\n const indented = redent(formatted, 4);\n return ` ${symbol} ${indented.trimStart()}\\n`;\n}\n"],"mappings":";;;;;;AAAA,IAAAA,WAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,WAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,OAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAL,uBAAA,CAAAC,OAAA;AAAiC,SAAAE,uBAAAG,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA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-1,3 +1,4 @@
1
+ export type MapPropsFunction = (props: Record<string, unknown>) => Record<string, unknown>;
1
2
  /**
2
3
  * Preserve props that are helpful in diagnosing test failures, while stripping rest
3
4
  */
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.defaultMapProps = defaultMapProps;
7
7
  var _reactNative = require("react-native");
8
8
  var _object = require("./object");
9
- const propsToDisplay = ['accessible', 'accessibilityElementsHidden', 'accessibilityHint', 'accessibilityLabel', 'accessibilityLabelledBy', 'accessibilityRole', 'accessibilityViewIsModal', 'alt', 'aria-busy', 'aria-checked', 'aria-disabled', 'aria-expanded', 'aria-hidden', 'aria-label', 'aria-labelledby', 'aria-modal', 'aria-selected', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'defaultValue', 'importantForAccessibility', 'nativeID', 'placeholder', 'role', 'testID', 'title', 'value'];
9
+ const propsToDisplay = ['accessible', 'accessibilityElementsHidden', 'accessibilityHint', 'accessibilityLabel', 'accessibilityLabelledBy', 'accessibilityRole', 'accessibilityViewIsModal', 'alt', 'aria-busy', 'aria-checked', 'aria-disabled', 'aria-expanded', 'aria-hidden', 'aria-label', 'aria-labelledby', 'aria-modal', 'aria-selected', 'aria-valuemax', 'aria-valuemin', 'aria-valuenow', 'aria-valuetext', 'defaultValue', 'editable', 'importantForAccessibility', 'nativeID', 'placeholder', 'pointerEvents', 'role', 'testID', 'title', 'value'];
10
10
 
11
11
  /**
12
12
  * Preserve props that are helpful in diagnosing test failures, while stripping rest
@@ -47,4 +47,4 @@ function extractStyle(style) {
47
47
  const hasAnyKeys = Object.keys(result).length > 0;
48
48
  return hasAnyKeys ? result : undefined;
49
49
  }
50
- //# sourceMappingURL=format-default.js.map
50
+ //# sourceMappingURL=map-props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"map-props.js","names":["_reactNative","require","_object","propsToDisplay","defaultMapProps","props","result","styles","StyleSheet","flatten","style","styleToDisplay","extractStyle","undefined","accessibilityState","removeUndefinedKeys","accessibilityValue","forEach","propName","display","opacity","hasAnyKeys","Object","keys","length"],"sources":["../../src/helpers/map-props.ts"],"sourcesContent":["import type { ViewStyle } from 'react-native';\nimport { StyleSheet } from 'react-native';\n\nimport { removeUndefinedKeys } from './object';\n\nexport type MapPropsFunction = (props: Record<string, unknown>) => Record<string, unknown>;\n\nconst propsToDisplay = [\n 'accessible',\n 'accessibilityElementsHidden',\n 'accessibilityHint',\n 'accessibilityLabel',\n 'accessibilityLabelledBy',\n 'accessibilityRole',\n 'accessibilityViewIsModal',\n 'alt',\n 'aria-busy',\n 'aria-checked',\n 'aria-disabled',\n 'aria-expanded',\n 'aria-hidden',\n 'aria-label',\n 'aria-labelledby',\n 'aria-modal',\n 'aria-selected',\n 'aria-valuemax',\n 'aria-valuemin',\n 'aria-valuenow',\n 'aria-valuetext',\n 'defaultValue',\n 'editable',\n 'importantForAccessibility',\n 'nativeID',\n 'placeholder',\n 'pointerEvents',\n 'role',\n 'testID',\n 'title',\n 'value',\n] as const;\n\n/**\n * Preserve props that are helpful in diagnosing test failures, while stripping rest\n */\nexport function defaultMapProps(props: Record<string, unknown>): Record<string, unknown> {\n const result: Record<string, unknown> = {};\n\n const styles = StyleSheet.flatten(props.style as ViewStyle);\n const styleToDisplay = extractStyle(styles);\n if (styleToDisplay !== undefined) {\n result.style = styleToDisplay;\n }\n\n const accessibilityState = removeUndefinedKeys(props.accessibilityState);\n if (accessibilityState !== undefined) {\n result.accessibilityState = accessibilityState;\n }\n\n const accessibilityValue = removeUndefinedKeys(props.accessibilityValue);\n if (accessibilityValue !== undefined) {\n result.accessibilityValue = accessibilityValue;\n }\n\n propsToDisplay.forEach((propName) => {\n if (propName in props) {\n result[propName] = props[propName];\n }\n });\n\n return result;\n}\n\nfunction extractStyle(style: ViewStyle | undefined) {\n if (style == null) {\n return undefined;\n }\n\n const result: Record<string, unknown> = {};\n if (style.display === 'none') {\n result.display = 'none';\n }\n\n if (style.opacity === 0) {\n result.opacity = 0;\n }\n\n const hasAnyKeys = Object.keys(result).length > 0;\n return hasAnyKeys ? result : undefined;\n}\n"],"mappings":";;;;;;AACA,IAAAA,YAAA,GAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAD,OAAA;AAIA,MAAME,cAAc,GAAG,CACrB,YAAY,EACZ,6BAA6B,EAC7B,mBAAmB,EACnB,oBAAoB,EACpB,yBAAyB,EACzB,mBAAmB,EACnB,0BAA0B,EAC1B,KAAK,EACL,WAAW,EACX,cAAc,EACd,eAAe,EACf,eAAe,EACf,aAAa,EACb,YAAY,EACZ,iBAAiB,EACjB,YAAY,EACZ,eAAe,EACf,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,2BAA2B,EAC3B,UAAU,EACV,aAAa,EACb,eAAe,EACf,MAAM,EACN,QAAQ,EACR,OAAO,EACP,OAAO,CACC;;AAEV;AACA;AACA;AACO,SAASC,eAAeA,CAACC,KAA8B,EAA2B;EACvF,MAAMC,MAA+B,GAAG,CAAC,CAAC;EAE1C,MAAMC,MAAM,GAAGC,uBAAU,CAACC,OAAO,CAACJ,KAAK,CAACK,KAAkB,CAAC;EAC3D,MAAMC,cAAc,GAAGC,YAAY,CAACL,MAAM,CAAC;EAC3C,IAAII,cAAc,KAAKE,SAAS,EAAE;IAChCP,MAAM,CAACI,KAAK,GAAGC,cAAc;EAC/B;EAEA,MAAMG,kBAAkB,GAAG,IAAAC,2BAAmB,EAACV,KAAK,CAACS,kBAAkB,CAAC;EACxE,IAAIA,kBAAkB,KAAKD,SAAS,EAAE;IACpCP,MAAM,CAACQ,kBAAkB,GAAGA,kBAAkB;EAChD;EAEA,MAAME,kBAAkB,GAAG,IAAAD,2BAAmB,EAACV,KAAK,CAACW,kBAAkB,CAAC;EACxE,IAAIA,kBAAkB,KAAKH,SAAS,EAAE;IACpCP,MAAM,CAACU,kBAAkB,GAAGA,kBAAkB;EAChD;EAEAb,cAAc,CAACc,OAAO,CAAEC,QAAQ,IAAK;IACnC,IAAIA,QAAQ,IAAIb,KAAK,EAAE;MACrBC,MAAM,CAACY,QAAQ,CAAC,GAAGb,KAAK,CAACa,QAAQ,CAAC;IACpC;EACF,CAAC,CAAC;EAEF,OAAOZ,MAAM;AACf;AAEA,SAASM,YAAYA,CAACF,KAA4B,EAAE;EAClD,IAAIA,KAAK,IAAI,IAAI,EAAE;IACjB,OAAOG,SAAS;EAClB;EAEA,MAAMP,MAA+B,GAAG,CAAC,CAAC;EAC1C,IAAII,KAAK,CAACS,OAAO,KAAK,MAAM,EAAE;IAC5Bb,MAAM,CAACa,OAAO,GAAG,MAAM;EACzB;EAEA,IAAIT,KAAK,CAACU,OAAO,KAAK,CAAC,EAAE;IACvBd,MAAM,CAACc,OAAO,GAAG,CAAC;EACpB;EAEA,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACjB,MAAM,CAAC,CAACkB,MAAM,GAAG,CAAC;EACjD,OAAOH,UAAU,GAAGf,MAAM,GAAGO,SAAS;AACxC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import { HostElement } from 'universal-test-renderer';
1
+ import type { HostElement } from 'universal-test-renderer';
2
2
  export interface AccessibilityStateMatcher {
3
3
  disabled?: boolean;
4
4
  selected?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"match-accessibility-state.js","names":["_accessibility","require","matchAccessibilityState","node","matcher","busy","undefined","computeAriaBusy","checked","computeAriaChecked","disabled","computeAriaDisabled","expanded","computeAriaExpanded","selected","computeAriaSelected"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import { HostElement } from 'universal-test-renderer';\nimport {\n computeAriaBusy,\n computeAriaChecked,\n computeAriaDisabled,\n computeAriaExpanded,\n computeAriaSelected,\n} from '../accessibility';\n\n// This type is the same as AccessibilityState from `react-native` package\n// It is re-declared here due to issues with migration from `@types/react-native` to\n// built in `react-native` types.\n// See: https://github.com/callstack/react-native-testing-library/issues/1351\nexport interface AccessibilityStateMatcher {\n disabled?: boolean;\n selected?: boolean;\n checked?: boolean | 'mixed';\n busy?: boolean;\n expanded?: boolean;\n}\n\nexport function matchAccessibilityState(node: HostElement, matcher: AccessibilityStateMatcher) {\n if (matcher.busy !== undefined && matcher.busy !== computeAriaBusy(node)) {\n return false;\n }\n if (matcher.checked !== undefined && matcher.checked !== computeAriaChecked(node)) {\n return false;\n }\n if (matcher.disabled !== undefined && matcher.disabled !== computeAriaDisabled(node)) {\n return false;\n }\n if (matcher.expanded !== undefined && matcher.expanded !== computeAriaExpanded(node)) {\n return false;\n }\n if (matcher.selected !== undefined && matcher.selected !== computeAriaSelected(node)) {\n return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;;AASO,SAASC,uBAAuBA,CAACC,IAAiB,EAAEC,OAAkC,EAAE;EAC7F,IAAIA,OAAO,CAACC,IAAI,KAAKC,SAAS,IAAIF,OAAO,CAACC,IAAI,KAAK,IAAAE,8BAAe,EAACJ,IAAI,CAAC,EAAE;IACxE,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACI,OAAO,KAAKF,SAAS,IAAIF,OAAO,CAACI,OAAO,KAAK,IAAAC,iCAAkB,EAACN,IAAI,CAAC,EAAE;IACjF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACM,QAAQ,KAAKJ,SAAS,IAAIF,OAAO,CAACM,QAAQ,KAAK,IAAAC,kCAAmB,EAACR,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACQ,QAAQ,KAAKN,SAAS,IAAIF,OAAO,CAACQ,QAAQ,KAAK,IAAAC,kCAAmB,EAACV,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACU,QAAQ,KAAKR,SAAS,IAAIF,OAAO,CAACU,QAAQ,KAAK,IAAAC,kCAAmB,EAACZ,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
1
+ {"version":3,"file":"match-accessibility-state.js","names":["_accessibility","require","matchAccessibilityState","node","matcher","busy","undefined","computeAriaBusy","checked","computeAriaChecked","disabled","computeAriaDisabled","expanded","computeAriaExpanded","selected","computeAriaSelected"],"sources":["../../../src/helpers/matchers/match-accessibility-state.ts"],"sourcesContent":["import type { HostElement } from 'universal-test-renderer';\n\nimport {\n computeAriaBusy,\n computeAriaChecked,\n computeAriaDisabled,\n computeAriaExpanded,\n computeAriaSelected,\n} from '../accessibility';\n\n// This type is the same as AccessibilityState from `react-native` package\n// It is re-declared here due to issues with migration from `@types/react-native` to\n// built in `react-native` types.\n// See: https://github.com/callstack/react-native-testing-library/issues/1351\nexport interface AccessibilityStateMatcher {\n disabled?: boolean;\n selected?: boolean;\n checked?: boolean | 'mixed';\n busy?: boolean;\n expanded?: boolean;\n}\n\nexport function matchAccessibilityState(node: HostElement, matcher: AccessibilityStateMatcher) {\n if (matcher.busy !== undefined && matcher.busy !== computeAriaBusy(node)) {\n return false;\n }\n if (matcher.checked !== undefined && matcher.checked !== computeAriaChecked(node)) {\n return false;\n }\n if (matcher.disabled !== undefined && matcher.disabled !== computeAriaDisabled(node)) {\n return false;\n }\n if (matcher.expanded !== undefined && matcher.expanded !== computeAriaExpanded(node)) {\n return false;\n }\n if (matcher.selected !== undefined && matcher.selected !== computeAriaSelected(node)) {\n return false;\n }\n\n return true;\n}\n"],"mappings":";;;;;;AAEA,IAAAA,cAAA,GAAAC,OAAA;AAQA;AACA;AACA;AACA;;AASO,SAASC,uBAAuBA,CAACC,IAAiB,EAAEC,OAAkC,EAAE;EAC7F,IAAIA,OAAO,CAACC,IAAI,KAAKC,SAAS,IAAIF,OAAO,CAACC,IAAI,KAAK,IAAAE,8BAAe,EAACJ,IAAI,CAAC,EAAE;IACxE,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACI,OAAO,KAAKF,SAAS,IAAIF,OAAO,CAACI,OAAO,KAAK,IAAAC,iCAAkB,EAACN,IAAI,CAAC,EAAE;IACjF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACM,QAAQ,KAAKJ,SAAS,IAAIF,OAAO,CAACM,QAAQ,KAAK,IAAAC,kCAAmB,EAACR,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACQ,QAAQ,KAAKN,SAAS,IAAIF,OAAO,CAACQ,QAAQ,KAAK,IAAAC,kCAAmB,EAACV,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EACA,IAAIC,OAAO,CAACU,QAAQ,KAAKR,SAAS,IAAIF,OAAO,CAACU,QAAQ,KAAK,IAAAC,kCAAmB,EAACZ,IAAI,CAAC,EAAE;IACpF,OAAO,KAAK;EACd;EAEA,OAAO,IAAI;AACb","ignoreList":[]}