@elench/testkit 0.1.64 → 0.1.66

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 (342) hide show
  1. package/lib/app/browser-bridge.mjs +66 -0
  2. package/lib/app/configs.mjs +81 -0
  3. package/lib/app/configs.test.mjs +34 -0
  4. package/lib/cli/command-helpers.mjs +2 -10
  5. package/lib/cli/commands/browser/serve.mjs +3 -62
  6. package/lib/cli/db.mjs +3 -68
  7. package/lib/config/binaries.mjs +34 -0
  8. package/lib/config/database.mjs +9 -6
  9. package/lib/config/index.mjs +2 -31
  10. package/lib/config/runtime.mjs +24 -95
  11. package/lib/config/validation.mjs +18 -62
  12. package/lib/coverage/backend-discovery.mjs +68 -85
  13. package/lib/coverage/backend-discovery.test.mjs +55 -46
  14. package/lib/coverage/evidence.mjs +15 -3
  15. package/lib/coverage/evidence.test.mjs +13 -4
  16. package/lib/coverage/graph-builder.mjs +25 -26
  17. package/lib/coverage/next-ir-to-graph.mjs +239 -0
  18. package/lib/coverage/routing.mjs +2 -29
  19. package/lib/coverage/routing.test.mjs +0 -16
  20. package/lib/coverage/shared.mjs +22 -82
  21. package/lib/database/fingerprint.mjs +1 -1
  22. package/lib/known-failures/github-cache.mjs +159 -0
  23. package/lib/known-failures/github-transport.mjs +174 -0
  24. package/lib/known-failures/github.mjs +17 -325
  25. package/lib/runner/default-runtime-runner.mjs +4 -10
  26. package/lib/runner/execution-config.mjs +12 -83
  27. package/lib/runner/live-run.mjs +45 -0
  28. package/lib/runner/managed-processes.mjs +29 -0
  29. package/lib/runner/orchestrator.mjs +57 -188
  30. package/lib/runner/playwright-runner.mjs +4 -11
  31. package/lib/runner/run-finalization.mjs +132 -0
  32. package/lib/runner/run-guards.mjs +45 -0
  33. package/lib/runner/runtime-preparation.mjs +1 -1
  34. package/lib/runner/services.mjs +3 -4
  35. package/lib/runner/template-steps.mjs +8 -45
  36. package/lib/runner/template.mjs +7 -28
  37. package/lib/shared/configured-steps.mjs +178 -0
  38. package/lib/shared/configured-steps.test.mjs +73 -0
  39. package/lib/shared/execution-schema.mjs +74 -0
  40. package/lib/shared/execution-schema.test.mjs +26 -0
  41. package/node_modules/@elench/next-analysis/dist/api-routes.d.ts +7 -0
  42. package/node_modules/@elench/next-analysis/dist/api-routes.d.ts.map +1 -0
  43. package/node_modules/@elench/next-analysis/dist/api-routes.js +66 -0
  44. package/node_modules/@elench/next-analysis/dist/api-routes.js.map +1 -0
  45. package/node_modules/@elench/next-analysis/dist/app-root.d.ts +2 -0
  46. package/node_modules/@elench/next-analysis/dist/app-root.d.ts.map +1 -0
  47. package/node_modules/@elench/next-analysis/dist/app-root.js +7 -0
  48. package/node_modules/@elench/next-analysis/dist/app-root.js.map +1 -0
  49. package/node_modules/@elench/next-analysis/dist/backend-links.d.ts +8 -0
  50. package/node_modules/@elench/next-analysis/dist/backend-links.d.ts.map +1 -0
  51. package/node_modules/@elench/next-analysis/dist/backend-links.js +30 -0
  52. package/node_modules/@elench/next-analysis/dist/backend-links.js.map +1 -0
  53. package/node_modules/@elench/next-analysis/dist/index.d.ts +11 -0
  54. package/node_modules/@elench/next-analysis/dist/index.d.ts.map +1 -0
  55. package/node_modules/@elench/next-analysis/dist/index.js +10 -0
  56. package/node_modules/@elench/next-analysis/dist/index.js.map +1 -0
  57. package/node_modules/@elench/next-analysis/dist/pages.d.ts +7 -0
  58. package/node_modules/@elench/next-analysis/dist/pages.d.ts.map +1 -0
  59. package/node_modules/@elench/next-analysis/dist/pages.js +47 -0
  60. package/node_modules/@elench/next-analysis/dist/pages.js.map +1 -0
  61. package/node_modules/@elench/next-analysis/dist/project.d.ts +3 -0
  62. package/node_modules/@elench/next-analysis/dist/project.d.ts.map +1 -0
  63. package/node_modules/@elench/next-analysis/dist/project.js +102 -0
  64. package/node_modules/@elench/next-analysis/dist/project.js.map +1 -0
  65. package/node_modules/@elench/next-analysis/dist/route-tree.d.ts +7 -0
  66. package/node_modules/@elench/next-analysis/dist/route-tree.d.ts.map +1 -0
  67. package/node_modules/@elench/next-analysis/dist/route-tree.js +575 -0
  68. package/node_modules/@elench/next-analysis/dist/route-tree.js.map +1 -0
  69. package/node_modules/@elench/next-analysis/dist/routes.d.ts +6 -0
  70. package/node_modules/@elench/next-analysis/dist/routes.d.ts.map +1 -0
  71. package/node_modules/@elench/next-analysis/dist/routes.js +41 -0
  72. package/node_modules/@elench/next-analysis/dist/routes.js.map +1 -0
  73. package/node_modules/@elench/next-analysis/dist/server-actions.d.ts +7 -0
  74. package/node_modules/@elench/next-analysis/dist/server-actions.d.ts.map +1 -0
  75. package/node_modules/@elench/next-analysis/dist/server-actions.js +37 -0
  76. package/node_modules/@elench/next-analysis/dist/server-actions.js.map +1 -0
  77. package/node_modules/@elench/next-analysis/dist/shared.d.ts +57 -0
  78. package/node_modules/@elench/next-analysis/dist/shared.d.ts.map +1 -0
  79. package/node_modules/@elench/next-analysis/dist/shared.js +229 -0
  80. package/node_modules/@elench/next-analysis/dist/shared.js.map +1 -0
  81. package/node_modules/@elench/next-analysis/dist/swc.d.ts +53 -0
  82. package/node_modules/@elench/next-analysis/dist/swc.d.ts.map +1 -0
  83. package/node_modules/@elench/next-analysis/dist/swc.js +387 -0
  84. package/node_modules/@elench/next-analysis/dist/swc.js.map +1 -0
  85. package/node_modules/@elench/next-analysis/dist/types.d.ts +125 -0
  86. package/node_modules/@elench/next-analysis/dist/types.d.ts.map +1 -0
  87. package/node_modules/@elench/next-analysis/dist/types.js +2 -0
  88. package/node_modules/@elench/next-analysis/dist/types.js.map +1 -0
  89. package/node_modules/@elench/next-analysis/package.json +27 -0
  90. package/node_modules/@elench/testkit-bridge/dist/index.d.ts +36 -0
  91. package/node_modules/@elench/testkit-bridge/dist/index.d.ts.map +1 -0
  92. package/node_modules/@elench/testkit-bridge/dist/index.js +538 -0
  93. package/node_modules/@elench/testkit-bridge/dist/index.js.map +1 -0
  94. package/node_modules/@elench/testkit-bridge/package.json +16 -5
  95. package/node_modules/@elench/testkit-protocol/dist/index.d.ts +190 -0
  96. package/node_modules/@elench/testkit-protocol/dist/index.d.ts.map +1 -0
  97. package/node_modules/@elench/testkit-protocol/dist/index.js +296 -0
  98. package/node_modules/@elench/testkit-protocol/dist/index.js.map +1 -0
  99. package/node_modules/@elench/testkit-protocol/package.json +14 -7
  100. package/node_modules/@elench/ts-analysis/dist/callables.d.ts +8 -0
  101. package/node_modules/@elench/ts-analysis/dist/callables.d.ts.map +1 -0
  102. package/node_modules/@elench/ts-analysis/dist/callables.js +126 -0
  103. package/node_modules/@elench/ts-analysis/dist/callables.js.map +1 -0
  104. package/node_modules/@elench/ts-analysis/dist/exports.d.ts +6 -0
  105. package/node_modules/@elench/ts-analysis/dist/exports.d.ts.map +1 -0
  106. package/node_modules/@elench/ts-analysis/dist/exports.js +70 -0
  107. package/node_modules/@elench/ts-analysis/dist/exports.js.map +1 -0
  108. package/node_modules/@elench/ts-analysis/dist/index.d.ts +10 -0
  109. package/node_modules/@elench/ts-analysis/dist/index.d.ts.map +1 -0
  110. package/node_modules/@elench/ts-analysis/{src/index.mjs → dist/index.js} +9 -14
  111. package/node_modules/@elench/ts-analysis/dist/index.js.map +1 -0
  112. package/node_modules/@elench/ts-analysis/dist/jsx.d.ts +9 -0
  113. package/node_modules/@elench/ts-analysis/dist/jsx.d.ts.map +1 -0
  114. package/node_modules/@elench/ts-analysis/dist/jsx.js +68 -0
  115. package/node_modules/@elench/ts-analysis/dist/jsx.js.map +1 -0
  116. package/node_modules/@elench/ts-analysis/dist/project.d.ts +5 -0
  117. package/node_modules/@elench/ts-analysis/dist/project.d.ts.map +1 -0
  118. package/node_modules/@elench/ts-analysis/dist/project.js +90 -0
  119. package/node_modules/@elench/ts-analysis/dist/project.js.map +1 -0
  120. package/node_modules/@elench/ts-analysis/dist/requests.d.ts +6 -0
  121. package/node_modules/@elench/ts-analysis/dist/requests.d.ts.map +1 -0
  122. package/node_modules/@elench/ts-analysis/dist/requests.js +140 -0
  123. package/node_modules/@elench/ts-analysis/dist/requests.js.map +1 -0
  124. package/node_modules/@elench/ts-analysis/dist/resolution.d.ts +4 -0
  125. package/node_modules/@elench/ts-analysis/dist/resolution.d.ts.map +1 -0
  126. package/node_modules/@elench/ts-analysis/dist/resolution.js +53 -0
  127. package/node_modules/@elench/ts-analysis/dist/resolution.js.map +1 -0
  128. package/node_modules/@elench/ts-analysis/dist/shared.d.ts +6 -0
  129. package/node_modules/@elench/ts-analysis/dist/shared.d.ts.map +1 -0
  130. package/node_modules/@elench/ts-analysis/dist/shared.js +31 -0
  131. package/node_modules/@elench/ts-analysis/dist/shared.js.map +1 -0
  132. package/node_modules/@elench/ts-analysis/dist/syntax.d.ts +7 -0
  133. package/node_modules/@elench/ts-analysis/dist/syntax.d.ts.map +1 -0
  134. package/node_modules/@elench/ts-analysis/dist/syntax.js +27 -0
  135. package/node_modules/@elench/ts-analysis/dist/syntax.js.map +1 -0
  136. package/node_modules/@elench/ts-analysis/dist/types.d.ts +58 -0
  137. package/node_modules/@elench/ts-analysis/dist/types.d.ts.map +1 -0
  138. package/node_modules/@elench/ts-analysis/dist/types.js +2 -0
  139. package/node_modules/@elench/ts-analysis/dist/types.js.map +1 -0
  140. package/node_modules/@elench/ts-analysis/package.json +18 -2
  141. package/node_modules/@next/routing/README.md +91 -0
  142. package/node_modules/@next/routing/dist/__tests__/captures.test.d.ts +1 -0
  143. package/node_modules/@next/routing/dist/__tests__/conditions.test.d.ts +1 -0
  144. package/node_modules/@next/routing/dist/__tests__/dynamic-after-rewrites.test.d.ts +1 -0
  145. package/node_modules/@next/routing/dist/__tests__/i18n-resolve-routes.test.d.ts +1 -0
  146. package/node_modules/@next/routing/dist/__tests__/i18n.test.d.ts +1 -0
  147. package/node_modules/@next/routing/dist/__tests__/middleware.test.d.ts +1 -0
  148. package/node_modules/@next/routing/dist/__tests__/normalize-next-data.test.d.ts +1 -0
  149. package/node_modules/@next/routing/dist/__tests__/redirects.test.d.ts +1 -0
  150. package/node_modules/@next/routing/dist/__tests__/resolve-routes.test.d.ts +1 -0
  151. package/node_modules/@next/routing/dist/__tests__/rewrites.test.d.ts +1 -0
  152. package/node_modules/@next/routing/dist/destination.d.ts +22 -0
  153. package/node_modules/@next/routing/dist/i18n.d.ts +48 -0
  154. package/node_modules/@next/routing/dist/index.d.ts +5 -0
  155. package/node_modules/@next/routing/dist/index.js +1 -0
  156. package/node_modules/@next/routing/dist/matchers.d.ts +12 -0
  157. package/node_modules/@next/routing/dist/middleware.d.ts +12 -0
  158. package/node_modules/@next/routing/dist/next-data.d.ts +10 -0
  159. package/node_modules/@next/routing/dist/resolve-routes.d.ts +2 -0
  160. package/node_modules/@next/routing/dist/types.d.ts +97 -0
  161. package/node_modules/@next/routing/package.json +39 -0
  162. package/node_modules/@swc/core/README.md +100 -0
  163. package/node_modules/@swc/core/Visitor.d.ts +218 -0
  164. package/node_modules/@swc/core/Visitor.js +1399 -0
  165. package/node_modules/@swc/core/binding.d.ts +59 -0
  166. package/node_modules/@swc/core/binding.js +368 -0
  167. package/node_modules/@swc/core/index.d.ts +120 -0
  168. package/node_modules/@swc/core/index.js +443 -0
  169. package/node_modules/@swc/core/package.json +120 -0
  170. package/node_modules/@swc/core/postinstall.js +148 -0
  171. package/node_modules/@swc/core/spack.d.ts +51 -0
  172. package/node_modules/@swc/core/spack.js +87 -0
  173. package/node_modules/@swc/core/util.d.ts +1 -0
  174. package/node_modules/@swc/core/util.js +104 -0
  175. package/node_modules/@swc/core-linux-x64-gnu/README.md +3 -0
  176. package/node_modules/@swc/core-linux-x64-gnu/package.json +46 -0
  177. package/node_modules/@swc/core-linux-x64-gnu/swc.linux-x64-gnu.node +0 -0
  178. package/node_modules/@swc/counter/CHANGELOG.md +7 -0
  179. package/node_modules/@swc/counter/README.md +7 -0
  180. package/node_modules/@swc/counter/index.js +1 -0
  181. package/node_modules/@swc/counter/package.json +27 -0
  182. package/node_modules/@swc/types/LICENSE +201 -0
  183. package/node_modules/@swc/types/README.md +4 -0
  184. package/node_modules/@swc/types/assumptions.d.ts +92 -0
  185. package/node_modules/@swc/types/assumptions.js +2 -0
  186. package/node_modules/@swc/types/index.d.ts +2049 -0
  187. package/node_modules/@swc/types/index.js +2 -0
  188. package/node_modules/@swc/types/package.json +40 -0
  189. package/node_modules/typescript/LICENSE.txt +55 -0
  190. package/node_modules/typescript/README.md +50 -0
  191. package/node_modules/typescript/SECURITY.md +41 -0
  192. package/node_modules/typescript/ThirdPartyNoticeText.txt +193 -0
  193. package/node_modules/typescript/bin/tsc +2 -0
  194. package/node_modules/typescript/bin/tsserver +2 -0
  195. package/node_modules/typescript/lib/_tsc.js +133818 -0
  196. package/node_modules/typescript/lib/_tsserver.js +659 -0
  197. package/node_modules/typescript/lib/_typingsInstaller.js +222 -0
  198. package/node_modules/typescript/lib/cs/diagnosticMessages.generated.json +2122 -0
  199. package/node_modules/typescript/lib/de/diagnosticMessages.generated.json +2122 -0
  200. package/node_modules/typescript/lib/es/diagnosticMessages.generated.json +2122 -0
  201. package/node_modules/typescript/lib/fr/diagnosticMessages.generated.json +2122 -0
  202. package/node_modules/typescript/lib/it/diagnosticMessages.generated.json +2122 -0
  203. package/node_modules/typescript/lib/ja/diagnosticMessages.generated.json +2122 -0
  204. package/node_modules/typescript/lib/ko/diagnosticMessages.generated.json +2122 -0
  205. package/node_modules/typescript/lib/lib.d.ts +22 -0
  206. package/node_modules/typescript/lib/lib.decorators.d.ts +384 -0
  207. package/node_modules/typescript/lib/lib.decorators.legacy.d.ts +22 -0
  208. package/node_modules/typescript/lib/lib.dom.asynciterable.d.ts +41 -0
  209. package/node_modules/typescript/lib/lib.dom.d.ts +39429 -0
  210. package/node_modules/typescript/lib/lib.dom.iterable.d.ts +571 -0
  211. package/node_modules/typescript/lib/lib.es2015.collection.d.ts +147 -0
  212. package/node_modules/typescript/lib/lib.es2015.core.d.ts +597 -0
  213. package/node_modules/typescript/lib/lib.es2015.d.ts +28 -0
  214. package/node_modules/typescript/lib/lib.es2015.generator.d.ts +77 -0
  215. package/node_modules/typescript/lib/lib.es2015.iterable.d.ts +605 -0
  216. package/node_modules/typescript/lib/lib.es2015.promise.d.ts +81 -0
  217. package/node_modules/typescript/lib/lib.es2015.proxy.d.ts +128 -0
  218. package/node_modules/typescript/lib/lib.es2015.reflect.d.ts +144 -0
  219. package/node_modules/typescript/lib/lib.es2015.symbol.d.ts +46 -0
  220. package/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts +326 -0
  221. package/node_modules/typescript/lib/lib.es2016.array.include.d.ts +116 -0
  222. package/node_modules/typescript/lib/lib.es2016.d.ts +21 -0
  223. package/node_modules/typescript/lib/lib.es2016.full.d.ts +23 -0
  224. package/node_modules/typescript/lib/lib.es2016.intl.d.ts +31 -0
  225. package/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts +21 -0
  226. package/node_modules/typescript/lib/lib.es2017.d.ts +26 -0
  227. package/node_modules/typescript/lib/lib.es2017.date.d.ts +31 -0
  228. package/node_modules/typescript/lib/lib.es2017.full.d.ts +23 -0
  229. package/node_modules/typescript/lib/lib.es2017.intl.d.ts +44 -0
  230. package/node_modules/typescript/lib/lib.es2017.object.d.ts +49 -0
  231. package/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts +135 -0
  232. package/node_modules/typescript/lib/lib.es2017.string.d.ts +45 -0
  233. package/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts +53 -0
  234. package/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts +77 -0
  235. package/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts +53 -0
  236. package/node_modules/typescript/lib/lib.es2018.d.ts +24 -0
  237. package/node_modules/typescript/lib/lib.es2018.full.d.ts +24 -0
  238. package/node_modules/typescript/lib/lib.es2018.intl.d.ts +83 -0
  239. package/node_modules/typescript/lib/lib.es2018.promise.d.ts +30 -0
  240. package/node_modules/typescript/lib/lib.es2018.regexp.d.ts +37 -0
  241. package/node_modules/typescript/lib/lib.es2019.array.d.ts +79 -0
  242. package/node_modules/typescript/lib/lib.es2019.d.ts +24 -0
  243. package/node_modules/typescript/lib/lib.es2019.full.d.ts +24 -0
  244. package/node_modules/typescript/lib/lib.es2019.intl.d.ts +23 -0
  245. package/node_modules/typescript/lib/lib.es2019.object.d.ts +33 -0
  246. package/node_modules/typescript/lib/lib.es2019.string.d.ts +37 -0
  247. package/node_modules/typescript/lib/lib.es2019.symbol.d.ts +24 -0
  248. package/node_modules/typescript/lib/lib.es2020.bigint.d.ts +765 -0
  249. package/node_modules/typescript/lib/lib.es2020.d.ts +27 -0
  250. package/node_modules/typescript/lib/lib.es2020.date.d.ts +42 -0
  251. package/node_modules/typescript/lib/lib.es2020.full.d.ts +24 -0
  252. package/node_modules/typescript/lib/lib.es2020.intl.d.ts +474 -0
  253. package/node_modules/typescript/lib/lib.es2020.number.d.ts +28 -0
  254. package/node_modules/typescript/lib/lib.es2020.promise.d.ts +47 -0
  255. package/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts +99 -0
  256. package/node_modules/typescript/lib/lib.es2020.string.d.ts +44 -0
  257. package/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts +41 -0
  258. package/node_modules/typescript/lib/lib.es2021.d.ts +23 -0
  259. package/node_modules/typescript/lib/lib.es2021.full.d.ts +24 -0
  260. package/node_modules/typescript/lib/lib.es2021.intl.d.ts +166 -0
  261. package/node_modules/typescript/lib/lib.es2021.promise.d.ts +48 -0
  262. package/node_modules/typescript/lib/lib.es2021.string.d.ts +33 -0
  263. package/node_modules/typescript/lib/lib.es2021.weakref.d.ts +78 -0
  264. package/node_modules/typescript/lib/lib.es2022.array.d.ts +121 -0
  265. package/node_modules/typescript/lib/lib.es2022.d.ts +25 -0
  266. package/node_modules/typescript/lib/lib.es2022.error.d.ts +75 -0
  267. package/node_modules/typescript/lib/lib.es2022.full.d.ts +24 -0
  268. package/node_modules/typescript/lib/lib.es2022.intl.d.ts +145 -0
  269. package/node_modules/typescript/lib/lib.es2022.object.d.ts +26 -0
  270. package/node_modules/typescript/lib/lib.es2022.regexp.d.ts +39 -0
  271. package/node_modules/typescript/lib/lib.es2022.string.d.ts +25 -0
  272. package/node_modules/typescript/lib/lib.es2023.array.d.ts +924 -0
  273. package/node_modules/typescript/lib/lib.es2023.collection.d.ts +21 -0
  274. package/node_modules/typescript/lib/lib.es2023.d.ts +22 -0
  275. package/node_modules/typescript/lib/lib.es2023.full.d.ts +24 -0
  276. package/node_modules/typescript/lib/lib.es2023.intl.d.ts +56 -0
  277. package/node_modules/typescript/lib/lib.es2024.arraybuffer.d.ts +65 -0
  278. package/node_modules/typescript/lib/lib.es2024.collection.d.ts +29 -0
  279. package/node_modules/typescript/lib/lib.es2024.d.ts +26 -0
  280. package/node_modules/typescript/lib/lib.es2024.full.d.ts +24 -0
  281. package/node_modules/typescript/lib/lib.es2024.object.d.ts +29 -0
  282. package/node_modules/typescript/lib/lib.es2024.promise.d.ts +35 -0
  283. package/node_modules/typescript/lib/lib.es2024.regexp.d.ts +25 -0
  284. package/node_modules/typescript/lib/lib.es2024.sharedmemory.d.ts +68 -0
  285. package/node_modules/typescript/lib/lib.es2024.string.d.ts +29 -0
  286. package/node_modules/typescript/lib/lib.es5.d.ts +4601 -0
  287. package/node_modules/typescript/lib/lib.es6.d.ts +23 -0
  288. package/node_modules/typescript/lib/lib.esnext.array.d.ts +35 -0
  289. package/node_modules/typescript/lib/lib.esnext.collection.d.ts +96 -0
  290. package/node_modules/typescript/lib/lib.esnext.d.ts +29 -0
  291. package/node_modules/typescript/lib/lib.esnext.decorators.d.ts +28 -0
  292. package/node_modules/typescript/lib/lib.esnext.disposable.d.ts +193 -0
  293. package/node_modules/typescript/lib/lib.esnext.error.d.ts +24 -0
  294. package/node_modules/typescript/lib/lib.esnext.float16.d.ts +445 -0
  295. package/node_modules/typescript/lib/lib.esnext.full.d.ts +24 -0
  296. package/node_modules/typescript/lib/lib.esnext.intl.d.ts +21 -0
  297. package/node_modules/typescript/lib/lib.esnext.iterator.d.ts +148 -0
  298. package/node_modules/typescript/lib/lib.esnext.promise.d.ts +34 -0
  299. package/node_modules/typescript/lib/lib.esnext.sharedmemory.d.ts +25 -0
  300. package/node_modules/typescript/lib/lib.scripthost.d.ts +322 -0
  301. package/node_modules/typescript/lib/lib.webworker.asynciterable.d.ts +41 -0
  302. package/node_modules/typescript/lib/lib.webworker.d.ts +13150 -0
  303. package/node_modules/typescript/lib/lib.webworker.importscripts.d.ts +23 -0
  304. package/node_modules/typescript/lib/lib.webworker.iterable.d.ts +340 -0
  305. package/node_modules/typescript/lib/pl/diagnosticMessages.generated.json +2122 -0
  306. package/node_modules/typescript/lib/pt-br/diagnosticMessages.generated.json +2122 -0
  307. package/node_modules/typescript/lib/ru/diagnosticMessages.generated.json +2122 -0
  308. package/node_modules/typescript/lib/tr/diagnosticMessages.generated.json +2122 -0
  309. package/node_modules/typescript/lib/tsc.js +8 -0
  310. package/node_modules/typescript/lib/tsserver.js +8 -0
  311. package/node_modules/typescript/lib/tsserverlibrary.d.ts +17 -0
  312. package/node_modules/typescript/lib/tsserverlibrary.js +21 -0
  313. package/node_modules/typescript/lib/typesMap.json +497 -0
  314. package/node_modules/typescript/lib/typescript.d.ts +11437 -0
  315. package/node_modules/typescript/lib/typescript.js +200276 -0
  316. package/node_modules/typescript/lib/typingsInstaller.js +8 -0
  317. package/node_modules/typescript/lib/watchGuard.js +53 -0
  318. package/node_modules/typescript/lib/zh-cn/diagnosticMessages.generated.json +2122 -0
  319. package/node_modules/typescript/lib/zh-tw/diagnosticMessages.generated.json +2122 -0
  320. package/node_modules/typescript/package.json +120 -0
  321. package/package.json +13 -8
  322. package/lib/coverage/fs-walk.mjs +0 -64
  323. package/lib/coverage/next-discovery.mjs +0 -205
  324. package/lib/coverage/next-static-analysis.mjs +0 -1045
  325. package/node_modules/@elench/testkit-bridge/src/index.mjs +0 -583
  326. package/node_modules/@elench/testkit-bridge/src/index.test.mjs +0 -409
  327. package/node_modules/@elench/testkit-protocol/src/index.d.ts +0 -231
  328. package/node_modules/@elench/testkit-protocol/src/index.mjs +0 -265
  329. package/node_modules/@elench/testkit-protocol/src/index.test.mjs +0 -242
  330. package/node_modules/@elench/ts-analysis/src/callables.mjs +0 -135
  331. package/node_modules/@elench/ts-analysis/src/callables.test.mjs +0 -55
  332. package/node_modules/@elench/ts-analysis/src/exports.mjs +0 -69
  333. package/node_modules/@elench/ts-analysis/src/exports.test.mjs +0 -50
  334. package/node_modules/@elench/ts-analysis/src/jsx.mjs +0 -69
  335. package/node_modules/@elench/ts-analysis/src/jsx.test.mjs +0 -43
  336. package/node_modules/@elench/ts-analysis/src/project.mjs +0 -100
  337. package/node_modules/@elench/ts-analysis/src/project.test.mjs +0 -54
  338. package/node_modules/@elench/ts-analysis/src/requests.mjs +0 -141
  339. package/node_modules/@elench/ts-analysis/src/requests.test.mjs +0 -35
  340. package/node_modules/@elench/ts-analysis/src/resolution.mjs +0 -53
  341. package/node_modules/@elench/ts-analysis/src/shared.mjs +0 -32
  342. package/node_modules/@elench/ts-analysis/src/syntax.mjs +0 -27
@@ -1,69 +0,0 @@
1
- import ts from "typescript";
2
- import { createSourceFile } from "./syntax.mjs";
3
-
4
- export function extractExportedMethodBodies(content, methods, filePath = "route.ts") {
5
- const bodies = [];
6
- for (const method of methods) {
7
- const body = extractExportedFunctionBody(content, method, filePath);
8
- if (body) bodies.push([method, body]);
9
- }
10
- return bodies;
11
- }
12
-
13
- export function extractExportedFunctions(content, filePath = "module.ts") {
14
- const sourceFile = createSourceFile(filePath, content);
15
- const exported = [];
16
- for (const statement of sourceFile.statements) {
17
- if (!ts.isFunctionDeclaration(statement) || !statement.name || !hasExportModifier(statement.modifiers) || !statement.body) {
18
- continue;
19
- }
20
- exported.push({
21
- name: statement.name.text,
22
- body: bodyText(sourceFile, statement.body),
23
- });
24
- }
25
- return exported;
26
- }
27
-
28
- export function extractExportedFunctionBody(content, exportName, filePath = "module.ts") {
29
- const sourceFile = createSourceFile(filePath, content);
30
- for (const statement of sourceFile.statements) {
31
- if (!ts.isFunctionDeclaration(statement) || !statement.name || statement.name.text !== exportName) continue;
32
- if (!hasExportModifier(statement.modifiers) || !statement.body) return null;
33
- return bodyText(sourceFile, statement.body);
34
- }
35
- return null;
36
- }
37
-
38
- export function readBalancedBlock(content, startIndex) {
39
- let depth = 0;
40
- let inSingle = false;
41
- let inDouble = false;
42
- let inTemplate = false;
43
-
44
- for (let index = startIndex; index < content.length; index += 1) {
45
- const char = content[index];
46
- const previous = content[index - 1];
47
- if (char === "'" && !inDouble && !inTemplate && previous !== "\\") inSingle = !inSingle;
48
- if (char === '"' && !inSingle && !inTemplate && previous !== "\\") inDouble = !inDouble;
49
- if (char === "`" && !inSingle && !inDouble && previous !== "\\") inTemplate = !inTemplate;
50
- if (inSingle || inDouble || inTemplate) continue;
51
- if (char === "{") depth += 1;
52
- if (char === "}") {
53
- depth -= 1;
54
- if (depth === 0) {
55
- return content.slice(startIndex, index + 1);
56
- }
57
- }
58
- }
59
- return null;
60
- }
61
-
62
- function hasExportModifier(modifiers) {
63
- return Boolean(modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword));
64
- }
65
-
66
- function bodyText(sourceFile, bodyNode) {
67
- return sourceFile.text.slice(bodyNode.getStart(sourceFile), bodyNode.end);
68
- }
69
-
@@ -1,50 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import {
3
- extractExportedFunctionBody,
4
- extractExportedFunctions,
5
- extractExportedMethodBodies,
6
- readBalancedBlock,
7
- } from "./index.mjs";
8
-
9
- describe("@elench/ts-analysis exports", () => {
10
- it("extracts exported method bodies via AST", () => {
11
- const content = `
12
- export async function GET() {
13
- const template = "{not a block}";
14
- return template;
15
- }
16
-
17
- export async function POST() {
18
- return { ok: true };
19
- }
20
- `;
21
-
22
- expect(extractExportedMethodBodies(content, ["GET", "POST"], "route.ts")).toEqual([
23
- ["GET", expect.stringContaining('"{not a block}"')],
24
- ["POST", expect.stringContaining("{ ok: true }")],
25
- ]);
26
- });
27
-
28
- it("extracts exported named functions and bodies", () => {
29
- const content = `
30
- export async function saveSettings() {
31
- return updateSettings();
32
- }
33
-
34
- export function listSettings() {
35
- return [];
36
- }
37
- `;
38
-
39
- expect(extractExportedFunctions(content, "actions.ts")).toEqual([
40
- { name: "saveSettings", body: expect.stringContaining("updateSettings") },
41
- { name: "listSettings", body: expect.stringContaining("return [];") },
42
- ]);
43
- expect(extractExportedFunctionBody(content, "saveSettings", "actions.ts")).toContain("updateSettings");
44
- });
45
-
46
- it("reads a balanced block from a brace offset", () => {
47
- const content = "before { const tpl = `{nested}`; return tpl; } after";
48
- expect(readBalancedBlock(content, content.indexOf("{"))).toBe("{ const tpl = `{nested}`; return tpl; }");
49
- });
50
- });
@@ -1,69 +0,0 @@
1
- import ts from "typescript";
2
-
3
- export function walkJsx(sourceFile, visitor) {
4
- const visit = (node, formContext = null) => {
5
- let nextFormContext = formContext;
6
- if (ts.isJsxElement(node) || ts.isJsxSelfClosingElement(node)) {
7
- nextFormContext = visitor(node, formContext);
8
- }
9
-
10
- if (ts.isJsxElement(node)) {
11
- for (const child of node.children) visit(child, nextFormContext);
12
- return;
13
- }
14
-
15
- ts.forEachChild(node, (child) => visit(child, nextFormContext));
16
- };
17
-
18
- visit(sourceFile, null);
19
- }
20
-
21
- export function collectJsxAttributes(openingElement) {
22
- const attributes = {};
23
- for (const property of openingElement.attributes.properties) {
24
- if (!ts.isJsxAttribute(property)) continue;
25
- const name = property.name.text;
26
- if (!property.initializer) {
27
- attributes[name] = { stringValue: "true", expression: null };
28
- continue;
29
- }
30
- if (ts.isStringLiteral(property.initializer)) {
31
- attributes[name] = { stringValue: property.initializer.text, expression: null };
32
- continue;
33
- }
34
- if (ts.isJsxExpression(property.initializer)) {
35
- attributes[name] = {
36
- stringValue: property.initializer.expression && ts.isStringLiteralLike(property.initializer.expression)
37
- ? property.initializer.expression.text
38
- : null,
39
- expression: property.initializer.expression || null,
40
- };
41
- }
42
- }
43
- return attributes;
44
- }
45
-
46
- export function flattenJsxText(children) {
47
- let text = "";
48
- for (const child of children) {
49
- if (ts.isJsxText(child)) {
50
- text += child.getText().replace(/\s+/gu, " ");
51
- } else if (ts.isJsxExpression(child) && child.expression && ts.isStringLiteralLike(child.expression)) {
52
- text += child.expression.text;
53
- } else if (ts.isJsxElement(child)) {
54
- text += flattenJsxText(child.children);
55
- }
56
- }
57
- return text;
58
- }
59
-
60
- export function extractJsxLabel(node, attributes) {
61
- const ariaLabel = attributes["aria-label"]?.stringValue || attributes.title?.stringValue || null;
62
- if (ariaLabel) return ariaLabel;
63
- if (ts.isJsxElement(node)) {
64
- const text = flattenJsxText(node.children).trim();
65
- if (text) return text;
66
- }
67
- return null;
68
- }
69
-
@@ -1,43 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { collectJsxAttributes, createSourceFile, extractJsxLabel, walkJsx } from "./index.mjs";
3
-
4
- describe("@elench/ts-analysis JSX helpers", () => {
5
- it("walks JSX and extracts attributes and labels", () => {
6
- const sourceFile = createSourceFile(
7
- "page.tsx",
8
- `
9
- export default function Page() {
10
- return (
11
- <form action={submit}>
12
- <button data-testid="save-button" aria-label="Save settings">Save</button>
13
- </form>
14
- );
15
- }
16
- `
17
- );
18
- const tags = [];
19
-
20
- walkJsx(sourceFile, (node) => {
21
- const opening = "openingElement" in node ? node.openingElement : node;
22
- const attributes = collectJsxAttributes(opening);
23
- tags.push({
24
- tag: opening.tagName.getText(),
25
- label: extractJsxLabel(node, attributes),
26
- attributes,
27
- });
28
- return null;
29
- });
30
-
31
- expect(tags).toHaveLength(2);
32
- expect(tags[0].tag).toBe("form");
33
- expect(tags[0].attributes.action.stringValue).toBeNull();
34
- expect(tags[0].attributes.action.expression.getText()).toBe("submit");
35
- expect(tags[1]).toMatchObject({
36
- tag: "button",
37
- label: "Save settings",
38
- attributes: {
39
- "data-testid": { stringValue: "save-button", expression: null },
40
- },
41
- });
42
- });
43
- });
@@ -1,100 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import ts from "typescript";
4
- import { defaultCompilerOptions, normalizePath } from "./shared.mjs";
5
- import { resolveImportToSourceFile } from "./resolution.mjs";
6
-
7
- export function findNearestTsConfig(startDir) {
8
- return ts.findConfigFile(startDir, ts.sys.fileExists, "tsconfig.json") || null;
9
- }
10
-
11
- export function loadTsConfig(tsconfigPath) {
12
- const configFile = ts.readConfigFile(tsconfigPath, ts.sys.readFile);
13
- if (configFile.error) {
14
- return {
15
- tsconfigPath,
16
- rootDir: path.dirname(tsconfigPath),
17
- fileNames: [],
18
- options: defaultCompilerOptions(path.dirname(tsconfigPath)),
19
- errors: [configFile.error],
20
- };
21
- }
22
-
23
- const parsed = ts.parseJsonConfigFileContent(
24
- configFile.config,
25
- ts.sys,
26
- path.dirname(tsconfigPath),
27
- defaultCompilerOptions(path.dirname(tsconfigPath)),
28
- tsconfigPath
29
- );
30
-
31
- return {
32
- tsconfigPath,
33
- rootDir: path.dirname(tsconfigPath),
34
- fileNames: parsed.fileNames.map(normalizePath),
35
- options: parsed.options,
36
- errors: parsed.errors || [],
37
- };
38
- }
39
-
40
- export function createAnalysisProject({ rootDir, tsconfigPath = null } = {}) {
41
- const resolvedRoot = path.resolve(rootDir || process.cwd());
42
- const resolvedConfigPath = tsconfigPath ? path.resolve(tsconfigPath) : findNearestTsConfig(resolvedRoot);
43
- const config = resolvedConfigPath
44
- ? loadTsConfig(resolvedConfigPath)
45
- : {
46
- tsconfigPath: null,
47
- rootDir: resolvedRoot,
48
- fileNames: listProjectFiles(resolvedRoot),
49
- options: defaultCompilerOptions(resolvedRoot),
50
- errors: [],
51
- };
52
-
53
- const program = ts.createProgram(config.fileNames, config.options);
54
- const checker = program.getTypeChecker();
55
- const diagnostics = [...config.errors, ...ts.getPreEmitDiagnostics(program)];
56
-
57
- return {
58
- rootDir: config.rootDir,
59
- tsconfigPath: config.tsconfigPath,
60
- program,
61
- checker,
62
- compilerOptions: config.options,
63
- diagnostics,
64
- getSourceFiles() {
65
- return program.getSourceFiles().filter((file) => !file.isDeclarationFile);
66
- },
67
- getSourceFile(filePath) {
68
- return program.getSourceFile(path.isAbsolute(filePath) ? filePath : path.join(config.rootDir, filePath)) || null;
69
- },
70
- readSourceFile(filePath) {
71
- const sourceFile = this.getSourceFile(filePath);
72
- return sourceFile ? sourceFile.text : null;
73
- },
74
- resolveImport(fromFilePath, specifier) {
75
- return resolveImportToSourceFile(config.rootDir, normalizePath(fromFilePath), specifier, config.options);
76
- },
77
- };
78
- }
79
-
80
- function listProjectFiles(rootDir) {
81
- const results = [];
82
- const queue = [rootDir];
83
- while (queue.length > 0) {
84
- const current = queue.pop();
85
- for (const entry of fs.readdirSync(current, { withFileTypes: true })) {
86
- if (entry.isSymbolicLink()) continue;
87
- const absolutePath = path.join(current, entry.name);
88
- if (entry.isDirectory()) {
89
- if (entry.name === "node_modules" || entry.name === ".next" || entry.name === ".git") continue;
90
- queue.push(absolutePath);
91
- continue;
92
- }
93
- if (/\.(ts|tsx|js|jsx|mjs)$/u.test(entry.name)) {
94
- results.push(normalizePath(absolutePath));
95
- }
96
- }
97
- }
98
- return results.sort((left, right) => left.localeCompare(right));
99
- }
100
-
@@ -1,54 +0,0 @@
1
- import fs from "fs";
2
- import os from "os";
3
- import path from "path";
4
- import { afterEach, describe, expect, it } from "vitest";
5
- import { createAnalysisProject, findNearestTsConfig, loadTsConfig } from "./index.mjs";
6
-
7
- const cleanups = [];
8
-
9
- afterEach(() => {
10
- while (cleanups.length > 0) {
11
- cleanups.pop()();
12
- }
13
- });
14
-
15
- describe("@elench/ts-analysis project", () => {
16
- it("loads tsconfig-backed projects and resolves imports", () => {
17
- const rootDir = createProject({
18
- "tsconfig.json": JSON.stringify({
19
- compilerOptions: {
20
- baseUrl: ".",
21
- paths: {
22
- "@/*": ["src/*"],
23
- },
24
- jsx: "preserve",
25
- module: "esnext",
26
- target: "es2022",
27
- },
28
- include: ["src/**/*"],
29
- }),
30
- "src/app/page.tsx": `import { save } from "@/server/actions"; export default function Page() { return <button onClick={save}>Save</button>; }`,
31
- "src/server/actions.ts": `export async function save() { return true; }`,
32
- });
33
-
34
- const tsconfigPath = findNearestTsConfig(path.join(rootDir, "src", "app"));
35
- const config = loadTsConfig(tsconfigPath);
36
- const project = createAnalysisProject({ rootDir });
37
-
38
- expect(config.fileNames.some((filePath) => filePath.endsWith("src/app/page.tsx"))).toBe(true);
39
- expect(project.resolveImport("src/app/page.tsx", "@/server/actions")).toBe("src/server/actions.ts");
40
- expect(project.readSourceFile("src/server/actions.ts")).toContain("export async function save");
41
- expect(project.diagnostics).toEqual([]);
42
- });
43
- });
44
-
45
- function createProject(files) {
46
- const rootDir = fs.mkdtempSync(path.join(os.tmpdir(), "testkit-ts-analysis-"));
47
- cleanups.push(() => fs.rmSync(rootDir, { recursive: true, force: true }));
48
- for (const [relativePath, content] of Object.entries(files)) {
49
- const absolutePath = path.join(rootDir, relativePath);
50
- fs.mkdirSync(path.dirname(absolutePath), { recursive: true });
51
- fs.writeFileSync(absolutePath, content);
52
- }
53
- return rootDir;
54
- }
@@ -1,141 +0,0 @@
1
- import ts from "typescript";
2
- import { createSourceFile, extractStringLiteral } from "./syntax.mjs";
3
-
4
- const HTTP_WRAPPER_METHODS = {
5
- getJson: "GET",
6
- postJson: "POST",
7
- putJson: "PUT",
8
- patchJson: "PATCH",
9
- deleteJson: "DELETE",
10
- };
11
-
12
- export function extractHttpRequests(content, options = {}) {
13
- const filePath = options.filePath || "suite.testkit.ts";
14
- const normalizeRoute = options.normalizeRoute || defaultNormalizeRoute;
15
- const sourceFile = createSourceFile(filePath, content);
16
- const requests = [];
17
-
18
- const visit = (node) => {
19
- if (ts.isCallExpression(node)) {
20
- const request = resolveHttpRequestCall(node, { normalizeRoute, dynamicSegmentToken: options.dynamicSegmentToken });
21
- if (request) requests.push(request);
22
- }
23
- ts.forEachChild(node, visit);
24
- };
25
-
26
- visit(sourceFile);
27
- return dedupeRequests(requests);
28
- }
29
-
30
- export function extractPlaywrightVisitedRoutes(content, options = {}) {
31
- const filePath = options.filePath || "suite.pw.testkit.ts";
32
- const normalizeRoute = options.normalizeRoute || defaultNormalizeRoute;
33
- const sourceFile = createSourceFile(filePath, content);
34
- const routes = [];
35
-
36
- const visit = (node) => {
37
- if (ts.isCallExpression(node)) {
38
- const route = resolveGotoRoute(node, { normalizeRoute, dynamicSegmentToken: options.dynamicSegmentToken });
39
- if (route) routes.push(route);
40
- }
41
- ts.forEachChild(node, visit);
42
- };
43
-
44
- visit(sourceFile);
45
- return [...new Set(routes)];
46
- }
47
-
48
- export function extractRouteLiteral(node, options = {}) {
49
- const normalizeRoute = options.normalizeRoute || defaultNormalizeRoute;
50
- const literal = extractStringLiteral(node, options);
51
- if (!literal) return null;
52
- return normalizeRoute(literal.split("?")[0]);
53
- }
54
-
55
- function resolveGotoRoute(callExpression, options) {
56
- const callee = callExpression.expression;
57
- if (!ts.isPropertyAccessExpression(callee)) return null;
58
- if (callee.name.text !== "goto") return null;
59
- const pathArg = callExpression.arguments[0];
60
- const literal = extractStringLiteral(pathArg, options);
61
- if (!literal) return null;
62
- if (/^https?:\/\//u.test(literal)) {
63
- try {
64
- const parsed = new URL(literal);
65
- if (parsed.hostname === "localhost" || parsed.hostname === "127.0.0.1") {
66
- return options.normalizeRoute(parsed.pathname.split("?")[0]);
67
- }
68
- } catch {
69
- return null;
70
- }
71
- return null;
72
- }
73
- return options.normalizeRoute(literal.split("?")[0]);
74
- }
75
-
76
- function resolveHttpRequestCall(callExpression, options) {
77
- const callee = callExpression.expression;
78
- if (ts.isIdentifier(callee)) {
79
- if (callee.text === "fetch") {
80
- const path = extractRouteLiteral(callExpression.arguments[0], options);
81
- if (!path || !path.startsWith("/api/")) return null;
82
- return {
83
- method: extractFetchMethod(callExpression.arguments[1], options) || "GET",
84
- path,
85
- confidence: "high",
86
- };
87
- }
88
-
89
- const method = HTTP_WRAPPER_METHODS[callee.text];
90
- if (method) {
91
- const path = extractRouteLiteral(callExpression.arguments[0], options);
92
- if (!path || !path.startsWith("/api/")) return null;
93
- return { method, path, confidence: "high" };
94
- }
95
-
96
- if (callee.text === "rawReq") {
97
- const methodLiteral = extractStringLiteral(callExpression.arguments[0], options);
98
- const path = extractRouteLiteral(callExpression.arguments[1], options);
99
- if (!methodLiteral || !path) return null;
100
- return { method: methodLiteral.toUpperCase(), path, confidence: "high" };
101
- }
102
- }
103
-
104
- if (ts.isPropertyAccessExpression(callee) && callee.name.text === "rawReq") {
105
- const methodLiteral = extractStringLiteral(callExpression.arguments[0], options);
106
- const path = extractRouteLiteral(callExpression.arguments[1], options);
107
- if (!methodLiteral || !path) return null;
108
- return { method: methodLiteral.toUpperCase(), path, confidence: "high" };
109
- }
110
-
111
- return null;
112
- }
113
-
114
- function extractFetchMethod(node, options) {
115
- if (!node || !ts.isObjectLiteralExpression(node)) return null;
116
- for (const property of node.properties) {
117
- if (!ts.isPropertyAssignment(property)) continue;
118
- if (property.name.getText() !== "method") continue;
119
- const value = extractStringLiteral(property.initializer, options);
120
- return value ? value.toUpperCase() : null;
121
- }
122
- return null;
123
- }
124
-
125
- function dedupeRequests(requests) {
126
- const seen = new Set();
127
- return requests.filter((entry) => {
128
- const key = `${entry.method}:${entry.path}`;
129
- if (seen.has(key)) return false;
130
- seen.add(key);
131
- return true;
132
- });
133
- }
134
-
135
- function defaultNormalizeRoute(value) {
136
- const trimmed = String(value || "/").trim();
137
- if (!trimmed || trimmed === "/") return "/";
138
- const withLeadingSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
139
- return withLeadingSlash.length > 1 ? withLeadingSlash.replace(/\/+$/u, "") : withLeadingSlash;
140
- }
141
-
@@ -1,35 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { DEFAULT_DYNAMIC_SEGMENT_TOKEN } from "./index.mjs";
3
- import { extractHttpRequests, extractPlaywrightVisitedRoutes } from "./index.mjs";
4
-
5
- describe("@elench/ts-analysis requests", () => {
6
- it("extracts HTTP requests from fetch, wrappers, and rawReq", () => {
7
- const content = `
8
- await fetch("/api/projects", { method: "post" });
9
- await getJson("/api/projects/123");
10
- await rawReq("DELETE", \`/api/projects/\${projectId}\`);
11
- await fetch("/not-api/projects");
12
- `;
13
-
14
- expect(extractHttpRequests(content, { filePath: "suite.int.testkit.ts" })).toEqual([
15
- { method: "POST", path: "/api/projects", confidence: "high" },
16
- { method: "GET", path: "/api/projects/123", confidence: "high" },
17
- { method: "DELETE", path: `/api/projects/${DEFAULT_DYNAMIC_SEGMENT_TOKEN}`, confidence: "high" },
18
- ]);
19
- });
20
-
21
- it("extracts Playwright visited routes", () => {
22
- const content = `
23
- await page.goto("/dashboard");
24
- await page.goto(\`/projects/\${id}\`);
25
- await this.page.goto("http://localhost:3000/events");
26
- await page.goto("https://example.com/external");
27
- `;
28
-
29
- expect(extractPlaywrightVisitedRoutes(content, { filePath: "suite.pw.testkit.ts" })).toEqual([
30
- "/dashboard",
31
- `/projects/${DEFAULT_DYNAMIC_SEGMENT_TOKEN}`,
32
- "/events",
33
- ]);
34
- });
35
- });
@@ -1,53 +0,0 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import ts from "typescript";
4
- import { defaultCompilerOptions, normalizePath } from "./shared.mjs";
5
-
6
- export function resolveImportToSourceFile(serviceRoot, fromFilePath, specifier, compilerOptions = null) {
7
- if (!specifier) return null;
8
- if (specifier.startsWith(".")) {
9
- const fromDirectory = path.dirname(path.join(serviceRoot, fromFilePath));
10
- return resolveSourceCandidate(path.resolve(fromDirectory, specifier), serviceRoot);
11
- }
12
-
13
- const options = { ...defaultCompilerOptions(serviceRoot), ...(compilerOptions || {}) };
14
- const containingFile = path.join(serviceRoot, fromFilePath);
15
- const host = ts.sys;
16
- const resolved = ts.resolveModuleName(specifier, containingFile, options, host).resolvedModule;
17
- if (resolved?.resolvedFileName) {
18
- if (resolved.resolvedFileName.endsWith(".d.ts")) return null;
19
- return normalizeResolvedFile(serviceRoot, resolved.resolvedFileName);
20
- }
21
-
22
- if (specifier.startsWith("@/")) {
23
- const fromRoot = resolveSourceCandidate(path.join(serviceRoot, specifier.slice(2)), serviceRoot);
24
- if (fromRoot) return fromRoot;
25
- return resolveSourceCandidate(path.join(serviceRoot, "src", specifier.slice(2)), serviceRoot);
26
- }
27
- return null;
28
- }
29
-
30
- export function resolveSourceCandidate(basePath, serviceRoot = null) {
31
- const direct = [basePath, `${basePath}.ts`, `${basePath}.tsx`, `${basePath}.js`, `${basePath}.jsx`, `${basePath}.mjs`];
32
- for (const candidate of direct) {
33
- if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return normalizeResolvedFile(serviceRoot, candidate);
34
- }
35
- const indexed = [
36
- path.join(basePath, "index.ts"),
37
- path.join(basePath, "index.tsx"),
38
- path.join(basePath, "index.js"),
39
- path.join(basePath, "index.jsx"),
40
- path.join(basePath, "index.mjs"),
41
- ];
42
- for (const candidate of indexed) {
43
- if (fs.existsSync(candidate) && fs.statSync(candidate).isFile()) return normalizeResolvedFile(serviceRoot, candidate);
44
- }
45
- return null;
46
- }
47
-
48
- function normalizeResolvedFile(serviceRoot, resolvedFileName) {
49
- const normalized = normalizePath(resolvedFileName);
50
- if (!serviceRoot) return normalized;
51
- return normalizePath(path.relative(serviceRoot, normalized));
52
- }
53
-
@@ -1,32 +0,0 @@
1
- import path from "path";
2
- import ts from "typescript";
3
-
4
- export const DEFAULT_DYNAMIC_SEGMENT_TOKEN = "__TESTKIT_DYNAMIC_SEGMENT__";
5
-
6
- export function normalizePath(filePath) {
7
- return String(filePath || "").split(path.sep).join("/");
8
- }
9
-
10
- export function scriptKindForFile(filePath) {
11
- const normalized = normalizePath(filePath);
12
- if (normalized.endsWith(".tsx")) return ts.ScriptKind.TSX;
13
- if (normalized.endsWith(".jsx")) return ts.ScriptKind.JSX;
14
- if (normalized.endsWith(".js")) return ts.ScriptKind.JS;
15
- return ts.ScriptKind.TS;
16
- }
17
-
18
- export function defaultCompilerOptions(rootDir = process.cwd()) {
19
- return {
20
- allowJs: true,
21
- checkJs: false,
22
- jsx: ts.JsxEmit.Preserve,
23
- target: ts.ScriptTarget.ESNext,
24
- module: ts.ModuleKind.ESNext,
25
- moduleResolution: ts.ModuleResolutionKind.Bundler,
26
- baseUrl: rootDir,
27
- paths: {
28
- "@/*": ["./*", "./src/*"],
29
- },
30
- };
31
- }
32
-
@@ -1,27 +0,0 @@
1
- import ts from "typescript";
2
- import { DEFAULT_DYNAMIC_SEGMENT_TOKEN, scriptKindForFile } from "./shared.mjs";
3
-
4
- export function createSourceFile(filePath, content) {
5
- return ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, scriptKindForFile(filePath));
6
- }
7
-
8
- export function extractStringLiteral(node, options = {}) {
9
- const dynamicSegmentToken = options.dynamicSegmentToken || DEFAULT_DYNAMIC_SEGMENT_TOKEN;
10
- if (!node) return null;
11
- if (ts.isStringLiteralLike(node)) return node.text;
12
- if (ts.isNoSubstitutionTemplateLiteral(node)) return node.text;
13
- if (ts.isTemplateExpression(node)) {
14
- let value = node.head.text;
15
- for (const span of node.templateSpans) {
16
- value += dynamicSegmentToken;
17
- value += span.literal.text;
18
- }
19
- return value;
20
- }
21
- return null;
22
- }
23
-
24
- export function extractLineNumber(node) {
25
- return ts.getLineAndCharacterOfPosition(node.getSourceFile(), node.getStart()).line + 1;
26
- }
27
-