vitest-plugin-vis 3.5.1 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (366) hide show
  1. package/dist/asserts--HSSlgPD.mjs +8 -0
  2. package/dist/asserts--HSSlgPD.mjs.map +1 -0
  3. package/dist/augment-C1tjdh5B.d.mts +33 -0
  4. package/dist/augment-C1tjdh5B.d.mts.map +1 -0
  5. package/dist/auto_snapshot_matcher-C0y6mAeS.mjs +381 -0
  6. package/dist/auto_snapshot_matcher-C0y6mAeS.mjs.map +1 -0
  7. package/dist/auto_snapshot_options-BMRtKmod.d.mts +45 -0
  8. package/dist/auto_snapshot_options-BMRtKmod.d.mts.map +1 -0
  9. package/dist/auto_snapshot_options-DUOTpF2N.mjs +88 -0
  10. package/dist/auto_snapshot_options-DUOTpF2N.mjs.map +1 -0
  11. package/dist/base64-CHSENEAO.mjs +8 -0
  12. package/dist/base64-CHSENEAO.mjs.map +1 -0
  13. package/dist/client-api.d.mts +44 -0
  14. package/dist/client-api.d.mts.map +1 -0
  15. package/dist/client-api.mjs +14 -0
  16. package/dist/client-api.mjs.map +1 -0
  17. package/dist/commands.types-BVhcnnHw.d.mts +51 -0
  18. package/dist/commands.types-BVhcnnHw.d.mts.map +1 -0
  19. package/dist/config.d.mts +28 -0
  20. package/dist/config.d.mts.map +1 -0
  21. package/dist/config.mjs +412 -0
  22. package/dist/config.mjs.map +1 -0
  23. package/dist/constants-CTBaz8Ml.mjs +10 -0
  24. package/dist/constants-CTBaz8Ml.mjs.map +1 -0
  25. package/dist/index.d.mts +5 -0
  26. package/dist/index.mjs +6 -0
  27. package/dist/presets/auto.d.mts +1 -0
  28. package/dist/presets/auto.mjs +19 -0
  29. package/dist/presets/auto.mjs.map +1 -0
  30. package/dist/presets/enable.d.mts +1 -0
  31. package/dist/presets/enable.mjs +15 -0
  32. package/dist/presets/enable.mjs.map +1 -0
  33. package/dist/presets/manual.d.mts +1 -0
  34. package/dist/presets/manual.mjs +15 -0
  35. package/dist/presets/manual.mjs.map +1 -0
  36. package/dist/server-utils.d.mts +19 -0
  37. package/dist/server-utils.d.mts.map +1 -0
  38. package/dist/server-utils.mjs +4 -0
  39. package/dist/setup-DCytWz48.mjs +124 -0
  40. package/dist/setup-DCytWz48.mjs.map +1 -0
  41. package/dist/setup.d.mts +106 -0
  42. package/dist/setup.d.mts.map +1 -0
  43. package/dist/setup.mjs +8 -0
  44. package/dist/snapshot_path-7GliOSH_.mjs +58 -0
  45. package/dist/snapshot_path-7GliOSH_.mjs.map +1 -0
  46. package/dist/src-CSQnlFa9.mjs +1 -0
  47. package/dist/testing.d.mts +12 -0
  48. package/dist/testing.d.mts.map +1 -0
  49. package/dist/testing.mjs +65550 -0
  50. package/dist/testing.mjs.map +1 -0
  51. package/dist/to_match_image_snapshot.types--tTmHoRA.d.mts +9 -0
  52. package/dist/to_match_image_snapshot.types--tTmHoRA.d.mts.map +1 -0
  53. package/dist/trim_common_folder-DBThLerp.d.mts +9 -0
  54. package/dist/trim_common_folder-DBThLerp.d.mts.map +1 -0
  55. package/dist/types-CEmjj-A9.d.mts +144 -0
  56. package/dist/types-CEmjj-A9.d.mts.map +1 -0
  57. package/dist/types-DJYCbyT8.d.mts +63 -0
  58. package/dist/types-DJYCbyT8.d.mts.map +1 -0
  59. package/package.json +55 -39
  60. package/readme.md +58 -6
  61. package/src/client/actions/has_image_snapshot_action.ts +1 -1
  62. package/src/client/actions/load_image_snapshot_results_action.ts +1 -1
  63. package/src/client/actions/match_image_snapshot_action.ts +7 -5
  64. package/src/client/actions/match_page_image_snapshot_action.ts +6 -4
  65. package/src/client/expect/_ctx.ts +10 -0
  66. package/src/client/expect/to_match_image_snapshot.ts +3 -4
  67. package/src/client/external/browser/has_render_content.ts +3 -0
  68. package/src/client/{image_resizer.ts → external/browser/image_resizer.ts} +1 -1
  69. package/src/client/{vitest_browser_context_proxy.ts → external/vitest/vitest_browser_context_proxy.ts} +3 -3
  70. package/src/client/{vitest_suite_proxy.ts → external/vitest/vitest_suite_proxy.ts} +1 -1
  71. package/src/client/{align_images.ts → image/align_images.ts} +3 -3
  72. package/src/client/page/_ctx.ts +12 -0
  73. package/src/client/page/extend.ts +1 -1
  74. package/src/client/page/has_image_snapshot.mdx +1 -1
  75. package/src/client/page/has_image_snapshot.ts +4 -4
  76. package/src/client/page/to_match_image_snapshot.mdx +1 -1
  77. package/src/client/page/to_match_image_snapshot.ts +3 -4
  78. package/src/client/{compare_image_snapshot.logic.ts → snapshot/compare_image_snapshot.logic.ts} +1 -1
  79. package/src/client/{compare_image_snapshot.ts → snapshot/compare_image_snapshot.ts} +8 -9
  80. package/src/client/snapshot/should_take_snapshot.ts +6 -0
  81. package/src/client/suite/_ctx.ts +8 -0
  82. package/src/client/suite/auto_snapshot_matcher.ts +68 -0
  83. package/src/client/{ctx.ts → task/_ctx.ts} +1 -3
  84. package/src/client/{auto_snapshot_options.ts → task/auto_snapshot_options.ts} +20 -5
  85. package/src/client/{snapshot_meta.ts → task/snapshot_meta.ts} +6 -1
  86. package/src/client-api.ts +3 -2
  87. package/src/config/vis.ts +4 -4
  88. package/src/index.ts +1 -1
  89. package/src/server/browser_provider/browser_api.ts +2 -2
  90. package/src/server/browser_provider/playwright.ts +6 -4
  91. package/src/server/browser_provider/webdriverio.ts +3 -3
  92. package/src/server/commands/_assertions.ts +3 -3
  93. package/src/server/commands/augment.ts +9 -7
  94. package/src/server/commands/has_image_snapshot.ts +3 -6
  95. package/src/server/commands/image_snapshot_next_index.ts +3 -9
  96. package/src/server/commands/load_image_snapshot_results.ts +3 -23
  97. package/src/server/commands/prepare_image_snapshot_comparison.ts +4 -50
  98. package/src/server/commands/prepare_page_image_snapshot_comparison.ts +3 -45
  99. package/src/server/commands/setup_vis_suite.ts +3 -27
  100. package/src/server/project.ts +8 -7
  101. package/src/server/snapshot.ts +4 -4
  102. package/src/server/snapshot_path.ts +6 -5
  103. package/src/server/suite.ts +7 -12
  104. package/src/server/testing/stubBrowserCommandContext.ts +16 -0
  105. package/src/{testing → server/testing}/stubSuite.ts +7 -9
  106. package/src/server/testing/stubUserConfig.ts +6 -0
  107. package/src/server/vis_options.ts +4 -5
  108. package/src/server/vis_server_context.logic.ts +8 -8
  109. package/src/server/vis_server_context.types.ts +31 -26
  110. package/src/{client/setup → setup}/create_vis.ts +23 -78
  111. package/src/setup/readme.md +5 -0
  112. package/src/{client/setup → setup}/vis.ts +1 -1
  113. package/src/setup.ts +2 -2
  114. package/src/shared/commands.types.ts +71 -0
  115. package/src/shared/types.ts +55 -1
  116. package/src/testing.ts +0 -1
  117. package/esm/client/actions/has_image_snapshot_action.d.ts +0 -4
  118. package/esm/client/actions/has_image_snapshot_action.d.ts.map +0 -1
  119. package/esm/client/actions/has_image_snapshot_action.js +0 -6
  120. package/esm/client/actions/load_image_snapshot_results_action.d.ts +0 -3
  121. package/esm/client/actions/load_image_snapshot_results_action.d.ts.map +0 -1
  122. package/esm/client/actions/load_image_snapshot_results_action.js +0 -3
  123. package/esm/client/actions/match_image_snapshot_action.d.ts +0 -6
  124. package/esm/client/actions/match_image_snapshot_action.d.ts.map +0 -1
  125. package/esm/client/actions/match_image_snapshot_action.js +0 -20
  126. package/esm/client/actions/match_page_image_snapshot_action.d.ts +0 -6
  127. package/esm/client/actions/match_page_image_snapshot_action.d.ts.map +0 -1
  128. package/esm/client/actions/match_page_image_snapshot_action.js +0 -9
  129. package/esm/client/align_images.d.ts +0 -2
  130. package/esm/client/align_images.d.ts.map +0 -1
  131. package/esm/client/align_images.js +0 -10
  132. package/esm/client/auto_snapshot_options.d.ts +0 -29
  133. package/esm/client/auto_snapshot_options.d.ts.map +0 -1
  134. package/esm/client/auto_snapshot_options.js +0 -49
  135. package/esm/client/compare_image_snapshot.d.ts +0 -6
  136. package/esm/client/compare_image_snapshot.d.ts.map +0 -1
  137. package/esm/client/compare_image_snapshot.js +0 -52
  138. package/esm/client/compare_image_snapshot.logic.d.ts +0 -3
  139. package/esm/client/compare_image_snapshot.logic.d.ts.map +0 -1
  140. package/esm/client/compare_image_snapshot.logic.js +0 -12
  141. package/esm/client/ctx.d.ts +0 -7
  142. package/esm/client/ctx.d.ts.map +0 -1
  143. package/esm/client/ctx.js +0 -11
  144. package/esm/client/expect/augment.d.ts +0 -8
  145. package/esm/client/expect/augment.d.ts.map +0 -1
  146. package/esm/client/expect/augment.js +0 -1
  147. package/esm/client/expect/expectation_result.d.ts +0 -3
  148. package/esm/client/expect/expectation_result.d.ts.map +0 -1
  149. package/esm/client/expect/expectation_result.js +0 -5
  150. package/esm/client/expect/extend.d.ts +0 -2
  151. package/esm/client/expect/extend.d.ts.map +0 -1
  152. package/esm/client/expect/extend.js +0 -4
  153. package/esm/client/expect/to_match_image_snapshot.d.ts +0 -9
  154. package/esm/client/expect/to_match_image_snapshot.d.ts.map +0 -1
  155. package/esm/client/expect/to_match_image_snapshot.js +0 -21
  156. package/esm/client/expect/to_match_image_snapshot.types.d.ts +0 -5
  157. package/esm/client/expect/to_match_image_snapshot.types.d.ts.map +0 -1
  158. package/esm/client/expect/to_match_image_snapshot.types.js +0 -1
  159. package/esm/client/image_data.d.ts +0 -3
  160. package/esm/client/image_data.d.ts.map +0 -1
  161. package/esm/client/image_data.js +0 -33
  162. package/esm/client/image_resizer.d.ts +0 -9
  163. package/esm/client/image_resizer.d.ts.map +0 -1
  164. package/esm/client/image_resizer.js +0 -49
  165. package/esm/client/image_snapshot_options.d.ts +0 -2
  166. package/esm/client/image_snapshot_options.d.ts.map +0 -1
  167. package/esm/client/image_snapshot_options.js +0 -6
  168. package/esm/client/page/augment.d.ts +0 -7
  169. package/esm/client/page/augment.d.ts.map +0 -1
  170. package/esm/client/page/augment.js +0 -1
  171. package/esm/client/page/extend.d.ts +0 -2
  172. package/esm/client/page/extend.d.ts.map +0 -1
  173. package/esm/client/page/extend.js +0 -5
  174. package/esm/client/page/has_image_snapshot.d.ts +0 -10
  175. package/esm/client/page/has_image_snapshot.d.ts.map +0 -1
  176. package/esm/client/page/has_image_snapshot.js +0 -15
  177. package/esm/client/page/to_match_image_snapshot.d.ts +0 -6
  178. package/esm/client/page/to_match_image_snapshot.d.ts.map +0 -1
  179. package/esm/client/page/to_match_image_snapshot.js +0 -15
  180. package/esm/client/selector.d.ts +0 -7
  181. package/esm/client/selector.d.ts.map +0 -1
  182. package/esm/client/selector.js +0 -97
  183. package/esm/client/setup/create_vis.d.ts +0 -96
  184. package/esm/client/setup/create_vis.d.ts.map +0 -1
  185. package/esm/client/setup/create_vis.js +0 -109
  186. package/esm/client/setup/vis.ctx.d.ts +0 -12
  187. package/esm/client/setup/vis.ctx.d.ts.map +0 -1
  188. package/esm/client/setup/vis.ctx.js +0 -32
  189. package/esm/client/setup/vis.d.ts +0 -5
  190. package/esm/client/setup/vis.d.ts.map +0 -1
  191. package/esm/client/setup/vis.js +0 -6
  192. package/esm/client/should_take_snapshot.d.ts +0 -3
  193. package/esm/client/should_take_snapshot.d.ts.map +0 -1
  194. package/esm/client/should_take_snapshot.js +0 -3
  195. package/esm/client/snapshot_meta.d.ts +0 -6
  196. package/esm/client/snapshot_meta.d.ts.map +0 -1
  197. package/esm/client/snapshot_meta.js +0 -1
  198. package/esm/client/task_id.d.ts +0 -7
  199. package/esm/client/task_id.d.ts.map +0 -1
  200. package/esm/client/task_id.js +0 -10
  201. package/esm/client/vitest_browser_context_proxy.d.ts +0 -32
  202. package/esm/client/vitest_browser_context_proxy.d.ts.map +0 -1
  203. package/esm/client/vitest_browser_context_proxy.js +0 -11
  204. package/esm/client/vitest_suite_proxy.d.ts +0 -7
  205. package/esm/client/vitest_suite_proxy.d.ts.map +0 -1
  206. package/esm/client/vitest_suite_proxy.js +0 -8
  207. package/esm/client-api.d.ts +0 -12
  208. package/esm/client-api.d.ts.map +0 -1
  209. package/esm/client-api.js +0 -9
  210. package/esm/commands.d.ts +0 -5
  211. package/esm/commands.d.ts.map +0 -1
  212. package/esm/commands.js +0 -4
  213. package/esm/config/types.d.ts +0 -60
  214. package/esm/config/types.d.ts.map +0 -1
  215. package/esm/config/types.js +0 -1
  216. package/esm/config/vis.d.ts +0 -28
  217. package/esm/config/vis.d.ts.map +0 -1
  218. package/esm/config/vis.js +0 -27
  219. package/esm/config.d.ts +0 -4
  220. package/esm/config.d.ts.map +0 -1
  221. package/esm/config.js +0 -2
  222. package/esm/index.d.ts +0 -5
  223. package/esm/index.d.ts.map +0 -1
  224. package/esm/index.js +0 -4
  225. package/esm/presets/auto.d.ts +0 -2
  226. package/esm/presets/auto.d.ts.map +0 -1
  227. package/esm/presets/auto.js +0 -8
  228. package/esm/presets/enable.d.ts +0 -2
  229. package/esm/presets/enable.d.ts.map +0 -1
  230. package/esm/presets/enable.js +0 -4
  231. package/esm/presets/manual.d.ts +0 -2
  232. package/esm/presets/manual.d.ts.map +0 -1
  233. package/esm/presets/manual.js +0 -4
  234. package/esm/server/browser_provider/browser_api.d.ts +0 -3
  235. package/esm/server/browser_provider/browser_api.d.ts.map +0 -1
  236. package/esm/server/browser_provider/browser_api.js +0 -11
  237. package/esm/server/browser_provider/playwright.d.ts +0 -4
  238. package/esm/server/browser_provider/playwright.d.ts.map +0 -1
  239. package/esm/server/browser_provider/playwright.js +0 -18
  240. package/esm/server/browser_provider/types.d.ts +0 -10
  241. package/esm/server/browser_provider/types.d.ts.map +0 -1
  242. package/esm/server/browser_provider/types.js +0 -1
  243. package/esm/server/browser_provider/webdriverio.d.ts +0 -4
  244. package/esm/server/browser_provider/webdriverio.d.ts.map +0 -1
  245. package/esm/server/browser_provider/webdriverio.js +0 -12
  246. package/esm/server/commands/_assertions.d.ts +0 -5
  247. package/esm/server/commands/_assertions.d.ts.map +0 -1
  248. package/esm/server/commands/_assertions.js +0 -11
  249. package/esm/server/commands/augment.d.ts +0 -11
  250. package/esm/server/commands/augment.d.ts.map +0 -1
  251. package/esm/server/commands/augment.js +0 -1
  252. package/esm/server/commands/commands.d.ts +0 -9
  253. package/esm/server/commands/commands.d.ts.map +0 -1
  254. package/esm/server/commands/commands.js +0 -14
  255. package/esm/server/commands/has_image_snapshot.d.ts +0 -6
  256. package/esm/server/commands/has_image_snapshot.d.ts.map +0 -1
  257. package/esm/server/commands/has_image_snapshot.js +0 -6
  258. package/esm/server/commands/image_snapshot_next_index.d.ts +0 -9
  259. package/esm/server/commands/image_snapshot_next_index.d.ts.map +0 -1
  260. package/esm/server/commands/image_snapshot_next_index.js +0 -6
  261. package/esm/server/commands/load_image_snapshot_results.d.ts +0 -21
  262. package/esm/server/commands/load_image_snapshot_results.d.ts.map +0 -1
  263. package/esm/server/commands/load_image_snapshot_results.js +0 -6
  264. package/esm/server/commands/prepare_image_snapshot_comparison.d.ts +0 -38
  265. package/esm/server/commands/prepare_image_snapshot_comparison.d.ts.map +0 -1
  266. package/esm/server/commands/prepare_image_snapshot_comparison.js +0 -34
  267. package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts +0 -35
  268. package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts.map +0 -1
  269. package/esm/server/commands/prepare_page_image_snapshot_comparison.js +0 -27
  270. package/esm/server/commands/setup_vis_suite.d.ts +0 -15
  271. package/esm/server/commands/setup_vis_suite.d.ts.map +0 -1
  272. package/esm/server/commands/setup_vis_suite.js +0 -6
  273. package/esm/server/commands/types.d.ts +0 -3
  274. package/esm/server/commands/types.d.ts.map +0 -1
  275. package/esm/server/commands/types.js +0 -1
  276. package/esm/server/externals/file.d.ts +0 -10
  277. package/esm/server/externals/file.d.ts.map +0 -1
  278. package/esm/server/externals/file.js +0 -20
  279. package/esm/server/project.d.ts +0 -21
  280. package/esm/server/project.d.ts.map +0 -1
  281. package/esm/server/project.js +0 -13
  282. package/esm/server/snapshot.d.ts +0 -6
  283. package/esm/server/snapshot.d.ts.map +0 -1
  284. package/esm/server/snapshot.js +0 -29
  285. package/esm/server/snapshot_path.d.ts +0 -14
  286. package/esm/server/snapshot_path.d.ts.map +0 -1
  287. package/esm/server/snapshot_path.js +0 -34
  288. package/esm/server/snapshot_writer.d.ts +0 -13
  289. package/esm/server/snapshot_writer.d.ts.map +0 -1
  290. package/esm/server/snapshot_writer.js +0 -15
  291. package/esm/server/suite.d.ts +0 -54
  292. package/esm/server/suite.d.ts.map +0 -1
  293. package/esm/server/suite.js +0 -73
  294. package/esm/server/vis_options.d.ts +0 -19
  295. package/esm/server/vis_options.d.ts.map +0 -1
  296. package/esm/server/vis_options.js +0 -14
  297. package/esm/server/vis_server_context.d.ts +0 -50
  298. package/esm/server/vis_server_context.d.ts.map +0 -1
  299. package/esm/server/vis_server_context.deps.d.ts +0 -29
  300. package/esm/server/vis_server_context.deps.d.ts.map +0 -1
  301. package/esm/server/vis_server_context.deps.js +0 -10
  302. package/esm/server/vis_server_context.js +0 -2
  303. package/esm/server/vis_server_context.logic.d.ts +0 -53
  304. package/esm/server/vis_server_context.logic.d.ts.map +0 -1
  305. package/esm/server/vis_server_context.logic.js +0 -79
  306. package/esm/server/vis_server_context.types.d.ts +0 -54
  307. package/esm/server/vis_server_context.types.d.ts.map +0 -1
  308. package/esm/server/vis_server_context.types.js +0 -1
  309. package/esm/server-utils.d.ts +0 -4
  310. package/esm/server-utils.d.ts.map +0 -1
  311. package/esm/server-utils.js +0 -3
  312. package/esm/setup.d.ts +0 -5
  313. package/esm/setup.d.ts.map +0 -1
  314. package/esm/setup.js +0 -5
  315. package/esm/shared/asserts.d.ts +0 -2
  316. package/esm/shared/asserts.d.ts.map +0 -1
  317. package/esm/shared/asserts.js +0 -5
  318. package/esm/shared/base64.d.ts +0 -2
  319. package/esm/shared/base64.d.ts.map +0 -1
  320. package/esm/shared/base64.js +0 -3
  321. package/esm/shared/compare_image.d.ts +0 -6
  322. package/esm/shared/compare_image.d.ts.map +0 -1
  323. package/esm/shared/compare_image.js +0 -42
  324. package/esm/shared/constants.d.ts +0 -6
  325. package/esm/shared/constants.d.ts.map +0 -1
  326. package/esm/shared/constants.js +0 -5
  327. package/esm/shared/convert_threshold_unit.d.ts +0 -6
  328. package/esm/shared/convert_threshold_unit.d.ts.map +0 -1
  329. package/esm/shared/convert_threshold_unit.js +0 -10
  330. package/esm/shared/get_max_size.d.ts +0 -11
  331. package/esm/shared/get_max_size.d.ts.map +0 -1
  332. package/esm/shared/get_max_size.js +0 -5
  333. package/esm/shared/is_same_size.d.ts +0 -8
  334. package/esm/shared/is_same_size.d.ts.map +0 -1
  335. package/esm/shared/is_same_size.js +0 -3
  336. package/esm/shared/trim_common_folder.d.ts +0 -6
  337. package/esm/shared/trim_common_folder.d.ts.map +0 -1
  338. package/esm/shared/trim_common_folder.js +0 -11
  339. package/esm/shared/types.d.ts +0 -90
  340. package/esm/shared/types.d.ts.map +0 -1
  341. package/esm/shared/types.js +0 -1
  342. package/esm/testing/constants.d.ts +0 -9
  343. package/esm/testing/constants.d.ts.map +0 -1
  344. package/esm/testing/constants.js +0 -1933
  345. package/esm/testing/stubBrowserCommandContext.d.ts +0 -8
  346. package/esm/testing/stubBrowserCommandContext.d.ts.map +0 -1
  347. package/esm/testing/stubBrowserCommandContext.js +0 -12
  348. package/esm/testing/stubSuite.d.ts +0 -10
  349. package/esm/testing/stubSuite.d.ts.map +0 -1
  350. package/esm/testing/stubSuite.js +0 -27
  351. package/esm/testing/stubUserConfig.d.ts +0 -7
  352. package/esm/testing/stubUserConfig.d.ts.map +0 -1
  353. package/esm/testing/stubUserConfig.js +0 -4
  354. package/esm/testing.d.ts +0 -3
  355. package/esm/testing.d.ts.map +0 -1
  356. package/esm/testing.js +0 -2
  357. package/src/client/image_snapshot_options.ts +0 -6
  358. package/src/client/setup/vis.ctx.ts +0 -33
  359. package/src/client/should_take_snapshot.ts +0 -5
  360. package/src/server/commands/types.ts +0 -9
  361. package/src/testing/stubBrowserCommandContext.ts +0 -16
  362. package/src/testing/stubUserConfig.ts +0 -6
  363. /package/src/client/{image_data.ts → external/browser/image_data.ts} +0 -0
  364. /package/src/client/{selector.ts → external/browser/selector.ts} +0 -0
  365. /package/src/client/{auto_snapshot_options.mdx → task/auto_snapshot_options.mdx} +0 -0
  366. /package/src/client/{task_id.ts → task/task_id.ts} +0 -0
@@ -1,5 +0,0 @@
1
- import { page } from '@vitest/browser/context';
2
- import "./augment.js";
3
- import { hasImageSnapshot } from "./has_image_snapshot.js";
4
- import { toMatchImageSnapshot } from "./to_match_image_snapshot.js";
5
- page.extend({ hasImageSnapshot, toMatchImageSnapshot });
@@ -1,10 +0,0 @@
1
- import { type BrowserPage } from '@vitest/browser/context';
2
- import type { ImageSnapshotKeyOptions } from '../../shared/types.ts';
3
- export interface HasImageSnapshotAction {
4
- /**
5
- * Check if the snapshot image exists.
6
- */
7
- hasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined): Promise<boolean>;
8
- }
9
- export declare function hasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined): Promise<boolean>;
10
- //# sourceMappingURL=has_image_snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"has_image_snapshot.d.ts","sourceRoot":"","sources":["../../../src/client/page/has_image_snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAY,MAAM,yBAAyB,CAAA;AACpE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAKpE,MAAM,WAAW,sBAAsB;IACtC;;OAEG;IACH,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CACpG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,uBAAuB,GAAG,SAAS,oBAahG"}
@@ -1,15 +0,0 @@
1
- import { commands } from '@vitest/browser/context';
2
- import { hasImageSnapshotAction } from "../actions/has_image_snapshot_action.js";
3
- import { ctx } from "../ctx.js";
4
- import { toTaskId } from "../task_id.js";
5
- export function hasImageSnapshot(options) {
6
- const test = ctx.getCurrentTest();
7
- if (!test) {
8
- throw new Error('`hasImageSnapshot()` must be called in a test.');
9
- }
10
- if (test.concurrent) {
11
- throw new Error('`hasImageSnapshot()` cannot be called in a concurrent test because ' +
12
- "concurrent tests run at the same time in the same iframe and affect each other's environment. ");
13
- }
14
- return hasImageSnapshotAction(commands, toTaskId(test), options);
15
- }
@@ -1,6 +0,0 @@
1
- import type { ComparisonMethod, ToMatchPageImageSnapshotOptions } from '../../shared/types.ts';
2
- export interface ToMatchImageSnapshotAction {
3
- toMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(options?: ToMatchPageImageSnapshotOptions<M> | undefined): Promise<void>;
4
- }
5
- export declare function toMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(options?: ToMatchPageImageSnapshotOptions<M> | undefined): Promise<void>;
6
- //# sourceMappingURL=to_match_image_snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"to_match_image_snapshot.d.ts","sourceRoot":"","sources":["../../../src/client/page/to_match_image_snapshot.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,+BAA+B,EAAE,MAAM,uBAAuB,CAAA;AAK9F,MAAM,WAAW,0BAA0B;IAC1C,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,EACxD,OAAO,CAAC,EAAE,+BAA+B,CAAC,CAAC,CAAC,GAAG,SAAS,GACtD,OAAO,CAAC,IAAI,CAAC,CAAA;CAChB;AAED,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,EACxE,OAAO,CAAC,EAAE,+BAA+B,CAAC,CAAC,CAAC,GAAG,SAAS,iBAexD"}
@@ -1,15 +0,0 @@
1
- import { commands } from '@vitest/browser/context';
2
- import { matchPageImageSnapshotAction } from "../actions/match_page_image_snapshot_action.js";
3
- import { ctx } from "../ctx.js";
4
- import { toTaskId } from "../task_id.js";
5
- export function toMatchImageSnapshot(options) {
6
- const test = ctx.getCurrentTest();
7
- if (!test) {
8
- throw new Error('`toMatchImageSnapshot()` must be called in a test.');
9
- }
10
- if (test.concurrent) {
11
- throw new Error('`toMatchImageSnapshot()` cannot be called in a concurrent test because ' +
12
- "concurrent tests run at the same time in the same iframe and affect each other's environment.");
13
- }
14
- return matchPageImageSnapshotAction(commands, toTaskId(test), options);
15
- }
@@ -1,7 +0,0 @@
1
- /**
2
- * Most of the code in this file is copied from Vitest.
3
- *
4
- * @see https://github.com/vitest-dev/vitest/blob/main/packages/browser/src/client/utils.ts
5
- */
6
- export declare function convertElementToCssSelector(element: Element): string;
7
- //# sourceMappingURL=selector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../../src/client/selector.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,UAM3D"}
@@ -1,97 +0,0 @@
1
- /**
2
- * Most of the code in this file is copied from Vitest.
3
- *
4
- * @see https://github.com/vitest-dev/vitest/blob/main/packages/browser/src/client/utils.ts
5
- */
6
- export function convertElementToCssSelector(element) {
7
- if (!element || !(element instanceof Element)) {
8
- throw new Error(`Expected DOM element to be an instance of Element, received ${typeof element}`);
9
- }
10
- return getUniqueCssSelector(element);
11
- }
12
- function escapeIdForCSSSelector(id) {
13
- return id
14
- .split('')
15
- .map((char) => {
16
- const code = char.charCodeAt(0);
17
- if (char === ' ' ||
18
- char === '#' ||
19
- char === '.' ||
20
- char === ':' ||
21
- char === '[' ||
22
- char === ']' ||
23
- char === '>' ||
24
- char === '+' ||
25
- char === '~' ||
26
- char === '\\') {
27
- // Escape common special characters with backslashes
28
- return `\\${char}`;
29
- }
30
- if (code >= 0x10000) {
31
- // Unicode escape for characters outside the BMP
32
- return `\\${code.toString(16).toUpperCase().padStart(6, '0')} `;
33
- }
34
- if (code < 0x20 || code === 0x7f) {
35
- // Non-printable ASCII characters (0x00-0x1F and 0x7F) are escaped
36
- return `\\${code.toString(16).toUpperCase().padStart(2, '0')} `;
37
- }
38
- if (code >= 0x80) {
39
- // Non-ASCII characters (0x80 and above) are escaped
40
- return `\\${code.toString(16).toUpperCase().padStart(2, '0')} `;
41
- }
42
- // Allowable characters are used directly
43
- return char;
44
- })
45
- .join('');
46
- }
47
- function getUniqueCssSelector(el) {
48
- const path = [];
49
- let parent;
50
- let hasShadowRoot = false;
51
- // eslint-disable-next-line no-cond-assign
52
- while ((parent = getParent(el))) {
53
- if (parent.shadowRoot) {
54
- hasShadowRoot = true;
55
- }
56
- const tag = el.tagName;
57
- if (el.id) {
58
- path.push(`#${escapeIdForCSSSelector(el.id)}`);
59
- }
60
- else if (!el.nextElementSibling && !el.previousElementSibling) {
61
- path.push(tag.toLowerCase());
62
- }
63
- else {
64
- let index = 0;
65
- let sameTagSiblings = 0;
66
- let elementIndex = 0;
67
- for (const sibling of parent.children) {
68
- index++;
69
- if (sibling.tagName === tag) {
70
- sameTagSiblings++;
71
- }
72
- if (sibling === el) {
73
- elementIndex = index;
74
- }
75
- }
76
- if (sameTagSiblings > 1) {
77
- path.push(`${tag.toLowerCase()}:nth-child(${elementIndex})`);
78
- }
79
- else {
80
- path.push(tag.toLowerCase());
81
- }
82
- }
83
- el = parent;
84
- }
85
- return `${getBrowserState().provider === 'webdriverio' && hasShadowRoot ? '>>>' : ''}${path.reverse().join(' > ')}`;
86
- }
87
- function getParent(el) {
88
- const parent = el.parentNode;
89
- if (parent instanceof ShadowRoot) {
90
- return parent.host;
91
- }
92
- return parent;
93
- }
94
- function getBrowserState() {
95
- // @ts-expect-error not typed global
96
- return window.__vitest_browser_runner__;
97
- }
@@ -1,96 +0,0 @@
1
- import type { SetupVisSuiteCommand } from '../../server/commands/setup_vis_suite.ts';
2
- import type { ComparisonMethod } from '../../shared/types.ts';
3
- import type { SnapshotMeta } from '../snapshot_meta.ts';
4
- /**
5
- * Visual test configuration on the client side.
6
- */
7
- export type VisClientConfigurator<GM extends Record<string, any> | unknown = unknown> = {
8
- /**
9
- * Setup the visual test configuration.
10
- *
11
- * @example
12
- * ```ts
13
- * // Setup with auto snapshot enabled
14
- * vis().setup({ auto: true })
15
- *
16
- * // Setup with auto snapshot disabled
17
- * vis().setup({ auto: false })
18
- *
19
- * // Same as `vis.setup({ auto: false })`
20
- * vis.setup()
21
- *
22
- * // Setup with auto snapshot determined by the test meta
23
- * vis.setup({
24
- * auto: async ({ meta }) => meta['darkOnly'],
25
- * })
26
- *
27
- * // Setup with multiple auto snapshots
28
- * vis.setup({
29
- * auto: {
30
- * async light() { document.body.classList.remove('dark') },
31
- * async dark() { document.body.classList.add('dark') },
32
- * }
33
- * })
34
- * ```
35
- */
36
- setup(options?: {
37
- auto?: boolean | (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void) | Record<string, boolean | (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)>;
38
- }): void;
39
- /**
40
- * @deprecated Use `vis.setup()` instead.
41
- */
42
- presets: {
43
- /**
44
- * @deprecated Use `vis.setup()` instead.
45
- *
46
- * Enable visual testing.
47
- *
48
- * auto snapshot is turned off by default.
49
- * You can specify the test to take a snapshot during `afterEach()` hook with `setAutoSnapshotOptions()`.
50
- */
51
- enable(): void;
52
- /**
53
- * @deprecated Use `vis.setup()` instead.
54
- *
55
- * Enable visual testing.
56
- *
57
- * `setAutoSnapshotOptions` will have no effect in this preset.
58
- */
59
- manual(): void;
60
- /**
61
- * @deprecated Use `vis.setup()` instead.
62
- *
63
- * Enable automatic visual testing.
64
- *
65
- * This will take a snapshot after each test.
66
- */
67
- auto(): void;
68
- /**
69
- * @deprecated Use `vis.setup()` instead.
70
- *
71
- * Enable automatic visual testing with multiple themes.
72
- *
73
- * This will take a snapshot after each test for each theme.
74
- *
75
- * @param themes A record of theme names and their setup functions.
76
- *
77
- * @example
78
- * ```ts
79
- * vis().presets.theme({
80
- * light() { document.body.classList.add('light') },
81
- * dark() { document.body.classList.add('dark') },
82
- * })
83
- * ```
84
- */
85
- theme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(themes: Record<string, boolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)>): void;
86
- };
87
- beforeAll: {
88
- setup(): Promise<void>;
89
- };
90
- afterEach: {
91
- matchImageSnapshot(): Promise<void>;
92
- matchPerTheme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(themes: Record<string, boolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)>): () => Promise<void>;
93
- };
94
- };
95
- export declare function createVis<GM extends Record<string, any> | unknown = unknown>(commands: SetupVisSuiteCommand): VisClientConfigurator<GM>;
96
- //# sourceMappingURL=create_vis.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create_vis.d.ts","sourceRoot":"","sources":["../../../src/client/setup/create_vis.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA;AACpF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAI7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAGvD;;GAEG;AACH,MAAM,MAAM,qBAAqB,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,IAAI;IACvF;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE;QACf,IAAI,CAAC,EACF,OAAO,GACP,CAAC,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAC/E,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAC5B,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,GACvD,MAAM,CACN,MAAM,EACJ,OAAO,GACP,CAAC,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAC/E,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAC5B,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CACxD,CAAA;KACJ,GAAG,IAAI,CAAA;IACR;;OAEG;IACH,OAAO,EAAE;QACR;;;;;;;WAOG;QACH,MAAM,IAAI,IAAI,CAAA;QACd;;;;;;WAMG;QACH,MAAM,IAAI,IAAI,CAAA;QACd;;;;;;WAMG;QACH,IAAI,IAAI,IAAI,CAAA;QACZ;;;;;;;;;;;;;;;;WAgBG;QACH,KAAK,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAClF,MAAM,EAAE,MAAM,CACb,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CACpG,GACC,IAAI,CAAA;KACP,CAAA;IACD,SAAS,EAAE;QACV,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;KACtB,CAAA;IACD,SAAS,EAAE;QACV,kBAAkB,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;QACnC,aAAa,CAAC,CAAC,SAAS,gBAAgB,EAAE,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAC1F,MAAM,EAAE,MAAM,CACb,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,GAAG,IAAI,CAAC,CACpG,GACC,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;KACtB,CAAA;CACD,CAAA;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,GAAG,OAAO,EAAE,QAAQ,EAAE,oBAAoB,6BAmG3G"}
@@ -1,109 +0,0 @@
1
- import dedent from 'dedent';
2
- import { afterEach, beforeAll } from 'vitest';
3
- import { extractAutoSnapshotOptions, setAutoSnapshotOptions } from "../auto_snapshot_options.js";
4
- import { ctx } from "../ctx.js";
5
- import { shouldTakeSnapshot } from "../should_take_snapshot.js";
6
- import { toTaskId } from "../task_id.js";
7
- export function createVis(commands) {
8
- let subject;
9
- const vis = {
10
- setup(options) {
11
- if (!options || options.auto === false) {
12
- beforeAll(vis.beforeAll.setup);
13
- }
14
- else {
15
- beforeAll(async () => {
16
- await vis.beforeAll.setup();
17
- setAutoSnapshotOptions(true);
18
- });
19
- }
20
- if (typeof options?.auto === 'function') {
21
- afterEach(vis.afterEach.matchPerTheme({
22
- auto: options.auto,
23
- }));
24
- }
25
- else if (typeof options?.auto === 'object') {
26
- afterEach(vis.afterEach.matchPerTheme(options.auto));
27
- }
28
- else {
29
- afterEach(vis.afterEach.matchImageSnapshot);
30
- }
31
- },
32
- presets: {
33
- enable() {
34
- beforeAll(vis.beforeAll.setup);
35
- afterEach(vis.afterEach.matchImageSnapshot);
36
- },
37
- manual() {
38
- beforeAll(vis.beforeAll.setup);
39
- },
40
- auto() {
41
- beforeAll(async () => {
42
- await vis.beforeAll.setup();
43
- setAutoSnapshotOptions(true);
44
- });
45
- afterEach(vis.afterEach.matchImageSnapshot);
46
- },
47
- theme(themes) {
48
- beforeAll(async () => {
49
- await vis.beforeAll.setup();
50
- setAutoSnapshotOptions(true);
51
- });
52
- afterEach(vis.afterEach.matchPerTheme(themes));
53
- },
54
- },
55
- beforeAll: {
56
- async setup() {
57
- subject = (await commands.setupVisSuite()).subject;
58
- },
59
- },
60
- afterEach: {
61
- async matchImageSnapshot() {
62
- return vis.afterEach.matchPerTheme({ async auto() { } })();
63
- },
64
- matchPerTheme(themes) {
65
- return async function matchImageSnapshot() {
66
- const test = ctx.getCurrentTest();
67
- if ((test?.result?.errors?.length ?? 0) > 0)
68
- return;
69
- const meta = extractAutoSnapshotOptions(test);
70
- if (!shouldTakeSnapshot(meta))
71
- return;
72
- const errors = [];
73
- for (const themeId in themes) {
74
- try {
75
- await new Promise((a) => setTimeout(a, 10));
76
- const theme = themes[themeId];
77
- const r = typeof theme === 'function' ? await theme(meta) : theme;
78
- if (r === false)
79
- continue;
80
- await test.context.expect(getSubject(meta?.subject ?? subject)).toMatchImageSnapshot({
81
- ...meta,
82
- snapshotKey: meta?.snapshotKey ?? themeId,
83
- });
84
- }
85
- catch (error) {
86
- errors.push([themeId, error]);
87
- }
88
- }
89
- if (errors.length > 0) {
90
- if (errors.length === 1)
91
- throw errors[0][1];
92
- const taskId = toTaskId(test);
93
- throw new AggregateError(errors, dedent `Snapshot \`${taskId}\` mismatched
94
-
95
- ${errors
96
- .map(([themeId, error]) => {
97
- return `Theme \`${themeId}\` failed: ${error.message}`;
98
- })
99
- .join('\n\n')}`);
100
- }
101
- };
102
- },
103
- },
104
- };
105
- return vis;
106
- }
107
- function getSubject(selectors) {
108
- return selectors ? (document.querySelector(selectors) ?? document.body) : document.body;
109
- }
@@ -1,12 +0,0 @@
1
- import { afterEach, beforeAll, beforeEach, type Awaitable, type Suite } from 'vitest';
2
- export declare const ctx: {
3
- beforeAll: typeof beforeAll;
4
- beforeEach: typeof beforeEach;
5
- afterEach: typeof afterEach;
6
- commands: import("@vitest/browser/context").BrowserCommands;
7
- mock(): {
8
- beforeAllListeners: ((suite: Readonly<Suite | File>) => Awaitable<unknown>)[];
9
- };
10
- reset(): void;
11
- };
12
- //# sourceMappingURL=vis.ctx.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vis.ctx.d.ts","sourceRoot":"","sources":["../../../src/client/setup/vis.ctx.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAM,KAAK,SAAS,EAAE,KAAK,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEzF,eAAO,MAAM,GAAG;;;;;;qCAM0B,QAAQ,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,SAAS,CAAC,OAAO,CAAC;;;CAuBtF,CAAA"}
@@ -1,32 +0,0 @@
1
- import { commands } from '@vitest/browser/context';
2
- import { afterEach, beforeAll, beforeEach, vi } from 'vitest';
3
- export const ctx = {
4
- beforeAll,
5
- beforeEach,
6
- afterEach,
7
- commands,
8
- mock() {
9
- const beforeAllListeners = [];
10
- beforeEach(() => {
11
- ctx.beforeAll = vi.fn((fn) => {
12
- beforeAllListeners.push(fn);
13
- });
14
- ctx.beforeEach = vi.fn();
15
- ctx.afterEach = vi.fn();
16
- ctx.commands = {
17
- setupVisSuite: vi.fn(),
18
- };
19
- });
20
- afterEach(() => {
21
- ctx.reset();
22
- });
23
- return {
24
- beforeAllListeners,
25
- };
26
- },
27
- reset() {
28
- ctx.beforeAll = beforeAll;
29
- ctx.beforeEach = beforeEach;
30
- ctx.afterEach = afterEach;
31
- },
32
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * Visual test configuration on the client side.
3
- */
4
- export declare const vis: import("./create_vis.ts").VisClientConfigurator<unknown>;
5
- //# sourceMappingURL=vis.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vis.d.ts","sourceRoot":"","sources":["../../../src/client/setup/vis.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,GAAG,0DAAsB,CAAA"}
@@ -1,6 +0,0 @@
1
- import { commands } from '@vitest/browser/context';
2
- import { createVis } from "./create_vis.js";
3
- /**
4
- * Visual test configuration on the client side.
5
- */
6
- export const vis = createVis(commands);
@@ -1,3 +0,0 @@
1
- import type { SnapshotMeta } from './snapshot_meta.ts';
2
- export declare function shouldTakeSnapshot(meta: SnapshotMeta<any> | undefined): boolean | undefined;
3
- //# sourceMappingURL=should_take_snapshot.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"should_take_snapshot.d.ts","sourceRoot":"","sources":["../../src/client/should_take_snapshot.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEtD,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC,GAAG,SAAS,uBAErE"}
@@ -1,3 +0,0 @@
1
- export function shouldTakeSnapshot(meta) {
2
- return document.body.childElementCount > 0 && meta?.enable;
3
- }
@@ -1,6 +0,0 @@
1
- import type { ComparisonMethod, ImageSnapshotSubjectOptions, ToMatchImageSnapshotOptions } from '../shared/types.ts';
2
- export type SnapshotMeta<M extends ComparisonMethod> = ToMatchImageSnapshotOptions<M> & ImageSnapshotSubjectOptions & {
3
- enable?: boolean | undefined;
4
- [key: string]: unknown;
5
- };
6
- //# sourceMappingURL=snapshot_meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot_meta.d.ts","sourceRoot":"","sources":["../../src/client/snapshot_meta.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,MAAM,oBAAoB,CAAA;AAEpH,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,gBAAgB,IAAI,2BAA2B,CAAC,CAAC,CAAC,GACpF,2BAA2B,GAAG;IAC7B,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CACtB,CAAA"}
@@ -1 +0,0 @@
1
- export {};
@@ -1,7 +0,0 @@
1
- type Task = {
2
- name: string;
3
- suite?: Task | undefined;
4
- };
5
- export declare function toTaskId(task: Task): string;
6
- export {};
7
- //# sourceMappingURL=task_id.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"task_id.d.ts","sourceRoot":"","sources":["../../src/client/task_id.ts"],"names":[],"mappings":"AAAA,KAAK,IAAI,GAAG;IACX,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAA;CACxB,CAAA;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,IAAI,UAUlC"}
@@ -1,10 +0,0 @@
1
- export function toTaskId(task) {
2
- const l = [];
3
- let t = task;
4
- while (t?.suite) {
5
- l.unshift(t.suite.name.replace(/[^a-z0-9]/gi, '-').toLowerCase());
6
- t = t.suite;
7
- }
8
- l.push(task.name.replace(/[^a-z0-9]/gi, '-').toLowerCase());
9
- return l.join('/');
10
- }
@@ -1,32 +0,0 @@
1
- import type { BrowserCommands, Platform } from '@vitest/browser/context';
2
- import type { SerializedConfig } from 'vitest';
3
- export declare const server: {
4
- /**
5
- * Platform the Vitest server is running on.
6
- * The same as calling `process.platform` on the server.
7
- */
8
- platform: Platform;
9
- /**
10
- * Runtime version of the Vitest server.
11
- * The same as calling `process.version` on the server.
12
- */
13
- version: string;
14
- /**
15
- * Name of the browser provider.
16
- */
17
- provider: string;
18
- /**
19
- * Name of the current browser.
20
- */
21
- browser: string;
22
- /**
23
- * Available commands for the browser.
24
- * @see {@link https://vitest.dev/guide/browser/commands}
25
- */
26
- commands: BrowserCommands;
27
- /**
28
- * Serialized test config.
29
- */
30
- config: SerializedConfig;
31
- };
32
- //# sourceMappingURL=vitest_browser_context_proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest_browser_context_proxy.d.ts","sourceRoot":"","sources":["../../src/client/vitest_browser_context_proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAA;AAU9C,eAAO,MAAM,MAAM;IAClB;;;OAGG;cACO,QAAQ;IAClB;;;OAGG;aACM,MAAM;IACf;;OAEG;cACO,MAAM;IAChB;;OAEG;aACM,MAAM;IACf;;;OAGG;cACO,eAAe;IACzB;;OAEG;YACK,gBAAgB;CAKvB,CAAA"}
@@ -1,11 +0,0 @@
1
- let ctx;
2
- if (globalThis.__vitest_browser__) {
3
- import('@vitest/browser/context').then((m) => {
4
- ctx = m;
5
- });
6
- }
7
- export const server = new Proxy({}, {
8
- get(target, prop) {
9
- return target[prop] ?? (ctx?.server)[prop];
10
- },
11
- });
@@ -1,7 +0,0 @@
1
- import type { SnapshotTestMeta } from '../shared/types.ts';
2
- declare let vitestSuite: Awaited<typeof import('vitest/suite')>;
3
- export type CurrentTest = ReturnType<typeof vitestSuite.getCurrentTest> & SnapshotTestMeta;
4
- export declare const getCurrentTest: () => CurrentTest;
5
- export declare const getCurrentSuite: () => import("vitest").SuiteCollector<object>;
6
- export {};
7
- //# sourceMappingURL=vitest_suite_proxy.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vitest_suite_proxy.d.ts","sourceRoot":"","sources":["../../src/client/vitest_suite_proxy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAE1D,QAAA,IAAI,WAAW,EAAE,OAAO,CAAC,cAAc,cAAc,CAAC,CAAC,CAAA;AAQvD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,WAAW,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAAA;AAE1F,eAAO,MAAM,cAAc,QAA0C,WAAW,CAAA;AAChF,eAAO,MAAM,eAAe,+CAAuC,CAAA"}
@@ -1,8 +0,0 @@
1
- let vitestSuite;
2
- if (globalThis.__vitest_browser__) {
3
- import('vitest/suite').then((m) => {
4
- vitestSuite = m;
5
- });
6
- }
7
- export const getCurrentTest = () => vitestSuite?.getCurrentTest();
8
- export const getCurrentSuite = () => vitestSuite?.getCurrentSuite();
@@ -1,12 +0,0 @@
1
- import './server/commands/augment.ts';
2
- export * from './client/actions/has_image_snapshot_action.ts';
3
- export * from './client/actions/load_image_snapshot_results_action.ts';
4
- export * from './client/actions/match_image_snapshot_action.ts';
5
- export * from './client/actions/match_page_image_snapshot_action.ts';
6
- export { setAutoSnapshotOptions, type MetaTask } from './client/auto_snapshot_options.ts';
7
- export * from './client/expect/expectation_result.ts';
8
- export type * from './client/expect/to_match_image_snapshot.types.ts';
9
- export * from './client/task_id.ts';
10
- export * from './shared/constants.ts';
11
- export type * from './shared/types.ts';
12
- //# sourceMappingURL=client-api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-api.d.ts","sourceRoot":"","sources":["../src/client-api.ts"],"names":[],"mappings":"AAAA,OAAO,8BAA8B,CAAA;AAErC,cAAc,+CAA+C,CAAA;AAC7D,cAAc,wDAAwD,CAAA;AACtE,cAAc,iDAAiD,CAAA;AAC/D,cAAc,sDAAsD,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,KAAK,QAAQ,EAAE,MAAM,mCAAmC,CAAA;AACzF,cAAc,uCAAuC,CAAA;AACrD,mBAAmB,kDAAkD,CAAA;AACrE,cAAc,qBAAqB,CAAA;AACnC,cAAc,uBAAuB,CAAA;AACrC,mBAAmB,mBAAmB,CAAA"}
package/esm/client-api.js DELETED
@@ -1,9 +0,0 @@
1
- import "./server/commands/augment.js";
2
- export * from "./client/actions/has_image_snapshot_action.js";
3
- export * from "./client/actions/load_image_snapshot_results_action.js";
4
- export * from "./client/actions/match_image_snapshot_action.js";
5
- export * from "./client/actions/match_page_image_snapshot_action.js";
6
- export { setAutoSnapshotOptions } from "./client/auto_snapshot_options.js";
7
- export * from "./client/expect/expectation_result.js";
8
- export * from "./client/task_id.js";
9
- export * from "./shared/constants.js";
package/esm/commands.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export * from './server/commands/has_image_snapshot.ts';
2
- export * from './server/commands/image_snapshot_next_index.ts';
3
- export * from './server/commands/prepare_image_snapshot_comparison.ts';
4
- export * from './server/commands/setup_vis_suite.ts';
5
- //# sourceMappingURL=commands.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"commands.d.ts","sourceRoot":"","sources":["../src/commands.ts"],"names":[],"mappings":"AAAA,cAAc,yCAAyC,CAAA;AACvD,cAAc,gDAAgD,CAAA;AAC9D,cAAc,wDAAwD,CAAA;AACtE,cAAc,sCAAsC,CAAA"}
package/esm/commands.js DELETED
@@ -1,4 +0,0 @@
1
- export * from "./server/commands/has_image_snapshot.js";
2
- export * from "./server/commands/image_snapshot_next_index.js";
3
- export * from "./server/commands/prepare_image_snapshot_comparison.js";
4
- export * from "./server/commands/setup_vis_suite.js";