vitest-plugin-vis 3.5.0 → 4.0.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 (343) hide show
  1. package/dist/asserts--HSSlgPD.mjs +8 -0
  2. package/dist/asserts--HSSlgPD.mjs.map +1 -0
  3. package/dist/augment-BJmy1S7i.d.mts +31 -0
  4. package/dist/augment-BJmy1S7i.d.mts.map +1 -0
  5. package/dist/auto_snapshot_options-CAD43Zkp.mjs +90 -0
  6. package/dist/auto_snapshot_options-CAD43Zkp.mjs.map +1 -0
  7. package/dist/auto_snapshot_options-CaQCXDdi.d.mts +45 -0
  8. package/dist/auto_snapshot_options-CaQCXDdi.d.mts.map +1 -0
  9. package/dist/base64-CHSENEAO.mjs +8 -0
  10. package/dist/base64-CHSENEAO.mjs.map +1 -0
  11. package/dist/client-api.d.mts +141 -0
  12. package/dist/client-api.d.mts.map +1 -0
  13. package/dist/client-api.mjs +14 -0
  14. package/dist/client-api.mjs.map +1 -0
  15. package/dist/config.d.mts +28 -0
  16. package/dist/config.d.mts.map +1 -0
  17. package/dist/config.mjs +412 -0
  18. package/dist/config.mjs.map +1 -0
  19. package/dist/constants-CTBaz8Ml.mjs +10 -0
  20. package/dist/constants-CTBaz8Ml.mjs.map +1 -0
  21. package/dist/index.d.mts +5 -0
  22. package/dist/index.mjs +6 -0
  23. package/dist/presets/auto.d.mts +1 -0
  24. package/dist/presets/auto.mjs +19 -0
  25. package/dist/presets/auto.mjs.map +1 -0
  26. package/dist/presets/enable.d.mts +1 -0
  27. package/dist/presets/enable.mjs +15 -0
  28. package/dist/presets/enable.mjs.map +1 -0
  29. package/dist/presets/manual.d.mts +1 -0
  30. package/dist/presets/manual.mjs +15 -0
  31. package/dist/presets/manual.mjs.map +1 -0
  32. package/dist/server-utils.d.mts +19 -0
  33. package/dist/server-utils.d.mts.map +1 -0
  34. package/dist/server-utils.mjs +4 -0
  35. package/dist/setup-BWgIDtv-.mjs +141 -0
  36. package/dist/setup-BWgIDtv-.mjs.map +1 -0
  37. package/dist/setup.d.mts +110 -0
  38. package/dist/setup.d.mts.map +1 -0
  39. package/dist/setup.mjs +8 -0
  40. package/dist/setup_vis_suite-C6JGGT7B.d.mts +17 -0
  41. package/dist/setup_vis_suite-C6JGGT7B.d.mts.map +1 -0
  42. package/dist/snapshot_path-7GliOSH_.mjs +58 -0
  43. package/dist/snapshot_path-7GliOSH_.mjs.map +1 -0
  44. package/dist/src-CSQnlFa9.mjs +1 -0
  45. package/dist/task_id-DnS9_4Ub.mjs +316 -0
  46. package/dist/task_id-DnS9_4Ub.mjs.map +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-p-zilA_M.d.mts +9 -0
  52. package/dist/to_match_image_snapshot.types-p-zilA_M.d.mts.map +1 -0
  53. package/dist/trim_common_folder-ModiubEJ.d.mts +9 -0
  54. package/dist/trim_common_folder-ModiubEJ.d.mts.map +1 -0
  55. package/dist/types-DFb23VE1.d.mts +110 -0
  56. package/dist/types-DFb23VE1.d.mts.map +1 -0
  57. package/dist/types-Do1N7g4c.d.mts +63 -0
  58. package/dist/types-Do1N7g4c.d.mts.map +1 -0
  59. package/dist/vis_server_context.types-Ce1f9vOO.d.mts +1 -0
  60. package/package.json +60 -44
  61. package/readme.md +58 -6
  62. package/src/client/actions/match_image_snapshot_action.ts +1 -1
  63. package/src/client/actions/match_page_image_snapshot_action.ts +1 -1
  64. package/src/client/auto_snapshot_options.ts +16 -1
  65. package/src/client/compare_image_snapshot.ts +1 -1
  66. package/src/client/expect/to_match_image_snapshot.ts +1 -1
  67. package/src/client/page/extend.ts +1 -1
  68. package/src/client/page/has_image_snapshot.mdx +1 -1
  69. package/src/client/page/has_image_snapshot.ts +1 -1
  70. package/src/client/page/to_match_image_snapshot.mdx +1 -1
  71. package/src/client/page/to_match_image_snapshot.ts +1 -1
  72. package/src/client/setup/create_vis.ts +16 -14
  73. package/src/client/setup/vis.ctx.ts +4 -3
  74. package/src/client/setup/vis.ts +1 -1
  75. package/src/client/snapshot_meta.ts +5 -0
  76. package/src/client/vitest_browser_context_proxy.ts +3 -3
  77. package/src/config/vis.ts +4 -4
  78. package/src/server/browser_provider/browser_api.ts +2 -2
  79. package/src/server/browser_provider/playwright.ts +6 -4
  80. package/src/server/browser_provider/webdriverio.ts +3 -3
  81. package/src/server/commands/_assertions.ts +3 -3
  82. package/src/server/commands/augment.ts +1 -1
  83. package/src/server/commands/has_image_snapshot.ts +2 -2
  84. package/src/server/commands/image_snapshot_next_index.ts +2 -2
  85. package/src/server/commands/load_image_snapshot_results.ts +2 -3
  86. package/src/server/commands/prepare_image_snapshot_comparison.ts +2 -2
  87. package/src/server/commands/prepare_page_image_snapshot_comparison.ts +2 -2
  88. package/src/server/commands/setup_vis_suite.ts +3 -3
  89. package/src/server/project.ts +8 -7
  90. package/src/server/snapshot.ts +4 -4
  91. package/src/server/snapshot_path.ts +6 -5
  92. package/src/server/suite.ts +7 -12
  93. package/src/server/testing/stubBrowserCommandContext.ts +16 -0
  94. package/src/{testing → server/testing}/stubSuite.ts +7 -9
  95. package/src/server/testing/stubUserConfig.ts +6 -0
  96. package/src/server/vis_options.ts +4 -5
  97. package/src/server/vis_server_context.logic.ts +7 -7
  98. package/src/server/vis_server_context.types.ts +31 -26
  99. package/src/shared/trim_common_folder.ts +1 -0
  100. package/src/shared/types.ts +2 -0
  101. package/src/testing.ts +0 -1
  102. package/esm/client/actions/has_image_snapshot_action.d.ts +0 -4
  103. package/esm/client/actions/has_image_snapshot_action.d.ts.map +0 -1
  104. package/esm/client/actions/has_image_snapshot_action.js +0 -6
  105. package/esm/client/actions/load_image_snapshot_results_action.d.ts +0 -3
  106. package/esm/client/actions/load_image_snapshot_results_action.d.ts.map +0 -1
  107. package/esm/client/actions/load_image_snapshot_results_action.js +0 -3
  108. package/esm/client/actions/match_image_snapshot_action.d.ts +0 -6
  109. package/esm/client/actions/match_image_snapshot_action.d.ts.map +0 -1
  110. package/esm/client/actions/match_image_snapshot_action.js +0 -20
  111. package/esm/client/actions/match_page_image_snapshot_action.d.ts +0 -6
  112. package/esm/client/actions/match_page_image_snapshot_action.d.ts.map +0 -1
  113. package/esm/client/actions/match_page_image_snapshot_action.js +0 -9
  114. package/esm/client/align_images.d.ts +0 -2
  115. package/esm/client/align_images.d.ts.map +0 -1
  116. package/esm/client/align_images.js +0 -10
  117. package/esm/client/auto_snapshot_options.d.ts +0 -29
  118. package/esm/client/auto_snapshot_options.d.ts.map +0 -1
  119. package/esm/client/auto_snapshot_options.js +0 -49
  120. package/esm/client/compare_image_snapshot.d.ts +0 -6
  121. package/esm/client/compare_image_snapshot.d.ts.map +0 -1
  122. package/esm/client/compare_image_snapshot.js +0 -52
  123. package/esm/client/compare_image_snapshot.logic.d.ts +0 -3
  124. package/esm/client/compare_image_snapshot.logic.d.ts.map +0 -1
  125. package/esm/client/compare_image_snapshot.logic.js +0 -12
  126. package/esm/client/ctx.d.ts +0 -7
  127. package/esm/client/ctx.d.ts.map +0 -1
  128. package/esm/client/ctx.js +0 -11
  129. package/esm/client/expect/augment.d.ts +0 -8
  130. package/esm/client/expect/augment.d.ts.map +0 -1
  131. package/esm/client/expect/augment.js +0 -1
  132. package/esm/client/expect/expectation_result.d.ts +0 -3
  133. package/esm/client/expect/expectation_result.d.ts.map +0 -1
  134. package/esm/client/expect/expectation_result.js +0 -5
  135. package/esm/client/expect/extend.d.ts +0 -2
  136. package/esm/client/expect/extend.d.ts.map +0 -1
  137. package/esm/client/expect/extend.js +0 -4
  138. package/esm/client/expect/to_match_image_snapshot.d.ts +0 -9
  139. package/esm/client/expect/to_match_image_snapshot.d.ts.map +0 -1
  140. package/esm/client/expect/to_match_image_snapshot.js +0 -21
  141. package/esm/client/expect/to_match_image_snapshot.types.d.ts +0 -5
  142. package/esm/client/expect/to_match_image_snapshot.types.d.ts.map +0 -1
  143. package/esm/client/expect/to_match_image_snapshot.types.js +0 -1
  144. package/esm/client/image_data.d.ts +0 -3
  145. package/esm/client/image_data.d.ts.map +0 -1
  146. package/esm/client/image_data.js +0 -33
  147. package/esm/client/image_resizer.d.ts +0 -9
  148. package/esm/client/image_resizer.d.ts.map +0 -1
  149. package/esm/client/image_resizer.js +0 -49
  150. package/esm/client/image_snapshot_options.d.ts +0 -2
  151. package/esm/client/image_snapshot_options.d.ts.map +0 -1
  152. package/esm/client/image_snapshot_options.js +0 -6
  153. package/esm/client/page/augment.d.ts +0 -7
  154. package/esm/client/page/augment.d.ts.map +0 -1
  155. package/esm/client/page/augment.js +0 -1
  156. package/esm/client/page/extend.d.ts +0 -2
  157. package/esm/client/page/extend.d.ts.map +0 -1
  158. package/esm/client/page/extend.js +0 -5
  159. package/esm/client/page/has_image_snapshot.d.ts +0 -10
  160. package/esm/client/page/has_image_snapshot.d.ts.map +0 -1
  161. package/esm/client/page/has_image_snapshot.js +0 -15
  162. package/esm/client/page/to_match_image_snapshot.d.ts +0 -6
  163. package/esm/client/page/to_match_image_snapshot.d.ts.map +0 -1
  164. package/esm/client/page/to_match_image_snapshot.js +0 -15
  165. package/esm/client/selector.d.ts +0 -7
  166. package/esm/client/selector.d.ts.map +0 -1
  167. package/esm/client/selector.js +0 -97
  168. package/esm/client/setup/create_vis.d.ts +0 -96
  169. package/esm/client/setup/create_vis.d.ts.map +0 -1
  170. package/esm/client/setup/create_vis.js +0 -109
  171. package/esm/client/setup/vis.ctx.d.ts +0 -12
  172. package/esm/client/setup/vis.ctx.d.ts.map +0 -1
  173. package/esm/client/setup/vis.ctx.js +0 -32
  174. package/esm/client/setup/vis.d.ts +0 -5
  175. package/esm/client/setup/vis.d.ts.map +0 -1
  176. package/esm/client/setup/vis.js +0 -6
  177. package/esm/client/should_take_snapshot.d.ts +0 -3
  178. package/esm/client/should_take_snapshot.d.ts.map +0 -1
  179. package/esm/client/should_take_snapshot.js +0 -3
  180. package/esm/client/snapshot_meta.d.ts +0 -6
  181. package/esm/client/snapshot_meta.d.ts.map +0 -1
  182. package/esm/client/snapshot_meta.js +0 -1
  183. package/esm/client/task_id.d.ts +0 -7
  184. package/esm/client/task_id.d.ts.map +0 -1
  185. package/esm/client/task_id.js +0 -10
  186. package/esm/client/vitest_browser_context_proxy.d.ts +0 -32
  187. package/esm/client/vitest_browser_context_proxy.d.ts.map +0 -1
  188. package/esm/client/vitest_browser_context_proxy.js +0 -11
  189. package/esm/client/vitest_suite_proxy.d.ts +0 -7
  190. package/esm/client/vitest_suite_proxy.d.ts.map +0 -1
  191. package/esm/client/vitest_suite_proxy.js +0 -8
  192. package/esm/client-api.d.ts +0 -12
  193. package/esm/client-api.d.ts.map +0 -1
  194. package/esm/client-api.js +0 -9
  195. package/esm/commands.d.ts +0 -5
  196. package/esm/commands.d.ts.map +0 -1
  197. package/esm/commands.js +0 -4
  198. package/esm/config/types.d.ts +0 -60
  199. package/esm/config/types.d.ts.map +0 -1
  200. package/esm/config/types.js +0 -1
  201. package/esm/config/vis.d.ts +0 -28
  202. package/esm/config/vis.d.ts.map +0 -1
  203. package/esm/config/vis.js +0 -27
  204. package/esm/config.d.ts +0 -4
  205. package/esm/config.d.ts.map +0 -1
  206. package/esm/config.js +0 -2
  207. package/esm/index.d.ts +0 -5
  208. package/esm/index.d.ts.map +0 -1
  209. package/esm/index.js +0 -4
  210. package/esm/presets/auto.d.ts +0 -2
  211. package/esm/presets/auto.d.ts.map +0 -1
  212. package/esm/presets/auto.js +0 -8
  213. package/esm/presets/enable.d.ts +0 -2
  214. package/esm/presets/enable.d.ts.map +0 -1
  215. package/esm/presets/enable.js +0 -4
  216. package/esm/presets/manual.d.ts +0 -2
  217. package/esm/presets/manual.d.ts.map +0 -1
  218. package/esm/presets/manual.js +0 -4
  219. package/esm/server/browser_provider/browser_api.d.ts +0 -3
  220. package/esm/server/browser_provider/browser_api.d.ts.map +0 -1
  221. package/esm/server/browser_provider/browser_api.js +0 -11
  222. package/esm/server/browser_provider/playwright.d.ts +0 -4
  223. package/esm/server/browser_provider/playwright.d.ts.map +0 -1
  224. package/esm/server/browser_provider/playwright.js +0 -18
  225. package/esm/server/browser_provider/types.d.ts +0 -10
  226. package/esm/server/browser_provider/types.d.ts.map +0 -1
  227. package/esm/server/browser_provider/types.js +0 -1
  228. package/esm/server/browser_provider/webdriverio.d.ts +0 -4
  229. package/esm/server/browser_provider/webdriverio.d.ts.map +0 -1
  230. package/esm/server/browser_provider/webdriverio.js +0 -12
  231. package/esm/server/commands/_assertions.d.ts +0 -5
  232. package/esm/server/commands/_assertions.d.ts.map +0 -1
  233. package/esm/server/commands/_assertions.js +0 -11
  234. package/esm/server/commands/augment.d.ts +0 -11
  235. package/esm/server/commands/augment.d.ts.map +0 -1
  236. package/esm/server/commands/augment.js +0 -1
  237. package/esm/server/commands/commands.d.ts +0 -9
  238. package/esm/server/commands/commands.d.ts.map +0 -1
  239. package/esm/server/commands/commands.js +0 -14
  240. package/esm/server/commands/has_image_snapshot.d.ts +0 -6
  241. package/esm/server/commands/has_image_snapshot.d.ts.map +0 -1
  242. package/esm/server/commands/has_image_snapshot.js +0 -6
  243. package/esm/server/commands/image_snapshot_next_index.d.ts +0 -9
  244. package/esm/server/commands/image_snapshot_next_index.d.ts.map +0 -1
  245. package/esm/server/commands/image_snapshot_next_index.js +0 -6
  246. package/esm/server/commands/load_image_snapshot_results.d.ts +0 -21
  247. package/esm/server/commands/load_image_snapshot_results.d.ts.map +0 -1
  248. package/esm/server/commands/load_image_snapshot_results.js +0 -6
  249. package/esm/server/commands/prepare_image_snapshot_comparison.d.ts +0 -38
  250. package/esm/server/commands/prepare_image_snapshot_comparison.d.ts.map +0 -1
  251. package/esm/server/commands/prepare_image_snapshot_comparison.js +0 -34
  252. package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts +0 -35
  253. package/esm/server/commands/prepare_page_image_snapshot_comparison.d.ts.map +0 -1
  254. package/esm/server/commands/prepare_page_image_snapshot_comparison.js +0 -27
  255. package/esm/server/commands/setup_vis_suite.d.ts +0 -15
  256. package/esm/server/commands/setup_vis_suite.d.ts.map +0 -1
  257. package/esm/server/commands/setup_vis_suite.js +0 -6
  258. package/esm/server/commands/types.d.ts +0 -3
  259. package/esm/server/commands/types.d.ts.map +0 -1
  260. package/esm/server/commands/types.js +0 -1
  261. package/esm/server/externals/file.d.ts +0 -10
  262. package/esm/server/externals/file.d.ts.map +0 -1
  263. package/esm/server/externals/file.js +0 -20
  264. package/esm/server/project.d.ts +0 -21
  265. package/esm/server/project.d.ts.map +0 -1
  266. package/esm/server/project.js +0 -13
  267. package/esm/server/snapshot.d.ts +0 -6
  268. package/esm/server/snapshot.d.ts.map +0 -1
  269. package/esm/server/snapshot.js +0 -29
  270. package/esm/server/snapshot_path.d.ts +0 -14
  271. package/esm/server/snapshot_path.d.ts.map +0 -1
  272. package/esm/server/snapshot_path.js +0 -34
  273. package/esm/server/snapshot_writer.d.ts +0 -13
  274. package/esm/server/snapshot_writer.d.ts.map +0 -1
  275. package/esm/server/snapshot_writer.js +0 -15
  276. package/esm/server/suite.d.ts +0 -54
  277. package/esm/server/suite.d.ts.map +0 -1
  278. package/esm/server/suite.js +0 -73
  279. package/esm/server/vis_options.d.ts +0 -19
  280. package/esm/server/vis_options.d.ts.map +0 -1
  281. package/esm/server/vis_options.js +0 -14
  282. package/esm/server/vis_server_context.d.ts +0 -50
  283. package/esm/server/vis_server_context.d.ts.map +0 -1
  284. package/esm/server/vis_server_context.deps.d.ts +0 -29
  285. package/esm/server/vis_server_context.deps.d.ts.map +0 -1
  286. package/esm/server/vis_server_context.deps.js +0 -10
  287. package/esm/server/vis_server_context.js +0 -2
  288. package/esm/server/vis_server_context.logic.d.ts +0 -53
  289. package/esm/server/vis_server_context.logic.d.ts.map +0 -1
  290. package/esm/server/vis_server_context.logic.js +0 -79
  291. package/esm/server/vis_server_context.types.d.ts +0 -54
  292. package/esm/server/vis_server_context.types.d.ts.map +0 -1
  293. package/esm/server/vis_server_context.types.js +0 -1
  294. package/esm/server-utils.d.ts +0 -4
  295. package/esm/server-utils.d.ts.map +0 -1
  296. package/esm/server-utils.js +0 -3
  297. package/esm/setup.d.ts +0 -5
  298. package/esm/setup.d.ts.map +0 -1
  299. package/esm/setup.js +0 -5
  300. package/esm/shared/asserts.d.ts +0 -2
  301. package/esm/shared/asserts.d.ts.map +0 -1
  302. package/esm/shared/asserts.js +0 -5
  303. package/esm/shared/base64.d.ts +0 -2
  304. package/esm/shared/base64.d.ts.map +0 -1
  305. package/esm/shared/base64.js +0 -3
  306. package/esm/shared/compare_image.d.ts +0 -6
  307. package/esm/shared/compare_image.d.ts.map +0 -1
  308. package/esm/shared/compare_image.js +0 -42
  309. package/esm/shared/constants.d.ts +0 -6
  310. package/esm/shared/constants.d.ts.map +0 -1
  311. package/esm/shared/constants.js +0 -5
  312. package/esm/shared/convert_threshold_unit.d.ts +0 -6
  313. package/esm/shared/convert_threshold_unit.d.ts.map +0 -1
  314. package/esm/shared/convert_threshold_unit.js +0 -10
  315. package/esm/shared/get_max_size.d.ts +0 -11
  316. package/esm/shared/get_max_size.d.ts.map +0 -1
  317. package/esm/shared/get_max_size.js +0 -5
  318. package/esm/shared/is_same_size.d.ts +0 -8
  319. package/esm/shared/is_same_size.d.ts.map +0 -1
  320. package/esm/shared/is_same_size.js +0 -3
  321. package/esm/shared/trim_common_folder.d.ts +0 -6
  322. package/esm/shared/trim_common_folder.d.ts.map +0 -1
  323. package/esm/shared/trim_common_folder.js +0 -10
  324. package/esm/shared/types.d.ts +0 -90
  325. package/esm/shared/types.d.ts.map +0 -1
  326. package/esm/shared/types.js +0 -1
  327. package/esm/testing/constants.d.ts +0 -9
  328. package/esm/testing/constants.d.ts.map +0 -1
  329. package/esm/testing/constants.js +0 -1933
  330. package/esm/testing/stubBrowserCommandContext.d.ts +0 -8
  331. package/esm/testing/stubBrowserCommandContext.d.ts.map +0 -1
  332. package/esm/testing/stubBrowserCommandContext.js +0 -12
  333. package/esm/testing/stubSuite.d.ts +0 -10
  334. package/esm/testing/stubSuite.d.ts.map +0 -1
  335. package/esm/testing/stubSuite.js +0 -27
  336. package/esm/testing/stubUserConfig.d.ts +0 -7
  337. package/esm/testing/stubUserConfig.d.ts.map +0 -1
  338. package/esm/testing/stubUserConfig.js +0 -4
  339. package/esm/testing.d.ts +0 -3
  340. package/esm/testing.d.ts.map +0 -1
  341. package/esm/testing.js +0 -2
  342. package/src/testing/stubBrowserCommandContext.ts +0 -16
  343. package/src/testing/stubUserConfig.ts +0 -6
@@ -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";
@@ -1,60 +0,0 @@
1
- import type { ComparisonMethod, FailureThresholdOptions, ImageSnapshotKeyOptions, ImageSnapshotSubjectOptions, ImageSnapshotTimeoutOptions, PixelComparisonOptions, PixelDiffOptions, SsimComparisonOptions, SsimDiffOptions } from '../shared/types.ts';
2
- export type { ComparisonMethod, PixelComparisonOptions, PixelDiffOptions, SsimComparisonOptions, SsimDiffOptions };
3
- export type VisOptions<M extends ComparisonMethod = 'pixel'> = (M extends 'ssim' ? {
4
- comparisonMethod: M;
5
- /**
6
- * Custom options passed to 'ssim'
7
- */
8
- diffOptions?: Partial<SsimDiffOptions> | undefined;
9
- } : {
10
- comparisonMethod?: M | undefined;
11
- /**
12
- * Custom options passed to 'pixelmatch'
13
- */
14
- diffOptions?: PixelDiffOptions | undefined;
15
- }) & FailureThresholdOptions & ImageSnapshotTimeoutOptions & ImageSnapshotKeyOptions & ImageSnapshotSubjectOptions & {
16
- /**
17
- * Loads the `test.setupFiles` of the specified preset.
18
- *
19
- * Note:
20
- * - 'enable` is deprecated. Use `manual` for the same effect.
21
- * - 'none` is deprecated. Use `custom` for the same effect.
22
- *
23
- * @default 'auto'
24
- *
25
- */
26
- preset?: 'enable' | 'manual' | 'auto' | 'custom' | 'none' | undefined;
27
- /**
28
- * The snapshot folder relative to the root of the project.
29
- *
30
- * Default: `{projectRoot}/__vis__/{platform}`
31
- */
32
- snapshotRootDir?: string | ((context: {
33
- ci: boolean;
34
- browserName?: string | undefined;
35
- providerName: string;
36
- platform: string;
37
- screenshotFailures?: boolean | undefined;
38
- screenshotDirectory?: string | undefined;
39
- }) => string) | undefined;
40
- /**
41
- * Customize the snapshot subpath.
42
- *
43
- * Typically, you place your test files either in a dedicated `tests` folder or in the `src` folder along with your source code.
44
- * By default, the snapshot subpath is the test file path with that folder removed to reduces nesting of the snapshot folders.
45
- *
46
- * If you place your test files in multiple folders,
47
- * such as in both `tests` and `src` folders,
48
- * and they might have files with the same name and create conflicting snapshots,
49
- * you can set this to customize the snapshot subpath.
50
- *
51
- * @param options - Options for customizing the snapshot subpath.
52
- * @property subPath - The path of the test file to be used as the snapshot subpath.
53
- * To retain the full path, simply return it.
54
- * @returns The customized snapshot subpath.
55
- */
56
- snapshotSubpath?: ((options: {
57
- subpath: string;
58
- }) => string) | undefined;
59
- };
60
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,gBAAgB,EAChB,uBAAuB,EACvB,uBAAuB,EACvB,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EACtB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,MAAM,oBAAoB,CAAA;AAE3B,YAAY,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,qBAAqB,EAAE,eAAe,EAAE,CAAA;AAElH,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,gBAAgB,GAAG,OAAO,IAAI,CAAC,CAAC,SAAS,MAAM,GAC7E;IACA,gBAAgB,EAAE,CAAC,CAAA;IACnB;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,CAAA;CAClD,GACA;IACA,gBAAgB,CAAC,EAAE,CAAC,GAAG,SAAS,CAAA;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,gBAAgB,GAAG,SAAS,CAAA;CAC1C,CAAC,GACH,uBAAuB,GACvB,2BAA2B,GAC3B,uBAAuB,GACvB,2BAA2B,GAAG;IAC7B;;;;;;;;;OASG;IACH,MAAM,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAA;IACrE;;;;OAIG;IACH,eAAe,CAAC,EACb,MAAM,GACN,CAAC,CAAC,OAAO,EAAE;QACX,EAAE,EAAE,OAAO,CAAA;QACX,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;QAChC,YAAY,EAAE,MAAM,CAAA;QACpB,QAAQ,EAAE,MAAM,CAAA;QAChB,kBAAkB,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;QACxC,mBAAmB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;KACvC,KAAK,MAAM,CAAC,GACb,SAAS,CAAA;IACZ;;;;;;;;;;;;;;;OAeG;IACH,eAAe,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC,GAAG,SAAS,CAAA;CACxE,CAAA"}