vitest-plugin-vis 4.0.0 → 4.2.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 (285) hide show
  1. package/dist/auto_snapshots/_ctx.mjs +15 -0
  2. package/dist/auto_snapshots/_ctx.mjs.map +1 -0
  3. package/dist/auto_snapshots/_extract_auto_snapshot_options.mjs +23 -0
  4. package/dist/auto_snapshots/_extract_auto_snapshot_options.mjs.map +1 -0
  5. package/dist/{auto_snapshot_options-CaQCXDdi.d.mts → auto_snapshots/auto_snapshot_options.d.mts} +5 -4
  6. package/dist/auto_snapshots/auto_snapshot_options.d.mts.map +1 -0
  7. package/dist/{auto_snapshot_options-CAD43Zkp.mjs → auto_snapshots/auto_snapshot_options.mjs} +6 -42
  8. package/dist/auto_snapshots/auto_snapshot_options.mjs.map +1 -0
  9. package/dist/auto_snapshots/snapshot_meta.d.mts +15 -0
  10. package/dist/auto_snapshots/snapshot_meta.d.mts.map +1 -0
  11. package/dist/client/actions/has_image_snapshot_action.d.mts +8 -0
  12. package/dist/client/actions/has_image_snapshot_action.d.mts.map +1 -0
  13. package/dist/client/actions/has_image_snapshot_action.mjs +9 -0
  14. package/dist/client/actions/has_image_snapshot_action.mjs.map +1 -0
  15. package/dist/client/actions/load_image_snapshot_results_action.d.mts +7 -0
  16. package/dist/client/actions/load_image_snapshot_results_action.d.mts.map +1 -0
  17. package/dist/client/actions/load_image_snapshot_results_action.mjs +8 -0
  18. package/dist/client/actions/load_image_snapshot_results_action.mjs.map +1 -0
  19. package/dist/client/actions/match_image_snapshot_action.d.mts +9 -0
  20. package/dist/client/actions/match_image_snapshot_action.d.mts.map +1 -0
  21. package/dist/client/actions/match_image_snapshot_action.mjs +20 -0
  22. package/dist/client/actions/match_image_snapshot_action.mjs.map +1 -0
  23. package/dist/client/actions/match_page_image_snapshot_action.d.mts +9 -0
  24. package/dist/client/actions/match_page_image_snapshot_action.d.mts.map +1 -0
  25. package/dist/client/actions/match_page_image_snapshot_action.mjs +14 -0
  26. package/dist/client/actions/match_page_image_snapshot_action.mjs.map +1 -0
  27. package/dist/client/expect/_ctx.mjs +15 -0
  28. package/dist/client/expect/_ctx.mjs.map +1 -0
  29. package/dist/client/expect/augment.d.mts +10 -0
  30. package/dist/client/expect/augment.d.mts.map +1 -0
  31. package/dist/client/expect/expectation_result.d.mts +7 -0
  32. package/dist/client/expect/expectation_result.d.mts.map +1 -0
  33. package/dist/client/expect/expectation_result.mjs +9 -0
  34. package/dist/client/expect/expectation_result.mjs.map +1 -0
  35. package/dist/client/expect/extend.d.mts +1 -0
  36. package/dist/client/expect/extend.mjs +9 -0
  37. package/dist/client/expect/extend.mjs.map +1 -0
  38. package/dist/client/expect/to_match_image_snapshot.mjs +16 -0
  39. package/dist/client/expect/to_match_image_snapshot.mjs.map +1 -0
  40. package/dist/{to_match_image_snapshot.types-p-zilA_M.d.mts → client/expect/to_match_image_snapshot.types.d.mts} +3 -3
  41. package/dist/client/expect/to_match_image_snapshot.types.d.mts.map +1 -0
  42. package/dist/client/external/browser/has_render_content.mjs +8 -0
  43. package/dist/client/external/browser/has_render_content.mjs.map +1 -0
  44. package/dist/client/external/browser/image_data.mjs +37 -0
  45. package/dist/client/external/browser/image_data.mjs.map +1 -0
  46. package/dist/client/external/browser/image_resizer.mjs +32 -0
  47. package/dist/client/external/browser/image_resizer.mjs.map +1 -0
  48. package/dist/client/external/browser/selector.mjs +57 -0
  49. package/dist/client/external/browser/selector.mjs.map +1 -0
  50. package/dist/client/external/vitest/vitest_browser_context_proxy.mjs +12 -0
  51. package/dist/client/external/vitest/vitest_browser_context_proxy.mjs.map +1 -0
  52. package/dist/client/external/vitest/vitest_suite_proxy.d.mts +3 -0
  53. package/dist/client/external/vitest/vitest_suite_proxy.mjs +11 -0
  54. package/dist/client/external/vitest/vitest_suite_proxy.mjs.map +1 -0
  55. package/dist/client/image/align_images.mjs +14 -0
  56. package/dist/client/image/align_images.mjs.map +1 -0
  57. package/dist/client/page/_ctx.d.mts +3 -0
  58. package/dist/client/page/_ctx.mjs +15 -0
  59. package/dist/client/page/_ctx.mjs.map +1 -0
  60. package/dist/client/page/augment.d.mts +9 -0
  61. package/dist/client/page/augment.d.mts.map +1 -0
  62. package/dist/client/page/extend.d.mts +1 -0
  63. package/dist/client/page/extend.mjs +13 -0
  64. package/dist/client/page/extend.mjs.map +1 -0
  65. package/dist/client/page/has_image_snapshot.d.mts +13 -0
  66. package/dist/client/page/has_image_snapshot.d.mts.map +1 -0
  67. package/dist/client/page/has_image_snapshot.mjs +15 -0
  68. package/dist/client/page/has_image_snapshot.mjs.map +1 -0
  69. package/dist/client/page/to_match_image_snapshot.d.mts +9 -0
  70. package/dist/client/page/to_match_image_snapshot.d.mts.map +1 -0
  71. package/dist/client/page/to_match_image_snapshot.mjs +15 -0
  72. package/dist/client/page/to_match_image_snapshot.mjs.map +1 -0
  73. package/dist/client/snapshot/compare_image_snapshot.logic.mjs +14 -0
  74. package/dist/client/snapshot/compare_image_snapshot.logic.mjs.map +1 -0
  75. package/dist/client/snapshot/compare_image_snapshot.mjs +63 -0
  76. package/dist/client/snapshot/compare_image_snapshot.mjs.map +1 -0
  77. package/dist/client/snapshot/should_take_snapshot.mjs +10 -0
  78. package/dist/client/snapshot/should_take_snapshot.mjs.map +1 -0
  79. package/dist/client/suite/_ctx.mjs +13 -0
  80. package/dist/client/suite/_ctx.mjs.map +1 -0
  81. package/dist/client/suite/auto_snapshot_matcher.d.mts +12 -0
  82. package/dist/client/suite/auto_snapshot_matcher.d.mts.map +1 -0
  83. package/dist/client/suite/auto_snapshot_matcher.mjs +50 -0
  84. package/dist/client/suite/auto_snapshot_matcher.mjs.map +1 -0
  85. package/dist/client/task/task_id.d.mts +9 -0
  86. package/dist/client/task/task_id.d.mts.map +1 -0
  87. package/dist/client/task/task_id.mjs +15 -0
  88. package/dist/client/task/task_id.mjs.map +1 -0
  89. package/dist/client-api.d.mts +13 -141
  90. package/dist/client-api.mjs +10 -13
  91. package/dist/{types-Do1N7g4c.d.mts → config/types.d.mts} +8 -9
  92. package/dist/config/types.d.mts.map +1 -0
  93. package/dist/config/vis.d.mts +27 -0
  94. package/dist/config/vis.d.mts.map +1 -0
  95. package/dist/config/vis.mjs +31 -0
  96. package/dist/config/vis.mjs.map +1 -0
  97. package/dist/config.d.mts +5 -28
  98. package/dist/config.mjs +3 -411
  99. package/dist/index.d.mts +5 -5
  100. package/dist/index.mjs +1 -4
  101. package/dist/presets/auto.mjs +4 -7
  102. package/dist/presets/auto.mjs.map +1 -1
  103. package/dist/presets/enable.mjs +2 -6
  104. package/dist/presets/enable.mjs.map +1 -1
  105. package/dist/presets/manual.mjs +2 -6
  106. package/dist/presets/manual.mjs.map +1 -1
  107. package/dist/server/browser_provider/browser_api.mjs +13 -0
  108. package/dist/server/browser_provider/browser_api.mjs.map +1 -0
  109. package/dist/server/browser_provider/playwright.mjs +24 -0
  110. package/dist/server/browser_provider/playwright.mjs.map +1 -0
  111. package/dist/server/browser_provider/webdriverio.mjs +16 -0
  112. package/dist/server/browser_provider/webdriverio.mjs.map +1 -0
  113. package/dist/server/commands/_assertions.mjs +10 -0
  114. package/dist/server/commands/_assertions.mjs.map +1 -0
  115. package/dist/server/commands/augment.d.mts +8 -0
  116. package/dist/server/commands/augment.d.mts.map +1 -0
  117. package/dist/server/commands/commands.mjs +20 -0
  118. package/dist/server/commands/commands.mjs.map +1 -0
  119. package/dist/server/commands/has_image_snapshot.mjs +12 -0
  120. package/dist/server/commands/has_image_snapshot.mjs.map +1 -0
  121. package/dist/server/commands/image_snapshot_next_index.mjs +12 -0
  122. package/dist/server/commands/image_snapshot_next_index.mjs.map +1 -0
  123. package/dist/server/commands/load_image_snapshot_results.mjs +12 -0
  124. package/dist/server/commands/load_image_snapshot_results.mjs.map +1 -0
  125. package/dist/server/commands/prepare_image_snapshot_comparison.mjs +37 -0
  126. package/dist/server/commands/prepare_image_snapshot_comparison.mjs.map +1 -0
  127. package/dist/server/commands/prepare_page_image_snapshot_comparison.mjs +27 -0
  128. package/dist/server/commands/prepare_page_image_snapshot_comparison.mjs.map +1 -0
  129. package/dist/server/commands/setup_vis_suite.mjs +12 -0
  130. package/dist/server/commands/setup_vis_suite.mjs.map +1 -0
  131. package/dist/server/externals/file.mjs +23 -0
  132. package/dist/server/externals/file.mjs.map +1 -0
  133. package/dist/server/project.mjs +13 -0
  134. package/dist/server/project.mjs.map +1 -0
  135. package/dist/server/snapshot.mjs +29 -0
  136. package/dist/server/snapshot.mjs.map +1 -0
  137. package/dist/server/snapshot_path.d.mts +17 -0
  138. package/dist/server/snapshot_path.d.mts.map +1 -0
  139. package/dist/{snapshot_path-7GliOSH_.mjs → server/snapshot_path.mjs} +7 -25
  140. package/dist/server/snapshot_path.mjs.map +1 -0
  141. package/dist/server/snapshot_writer.mjs +21 -0
  142. package/dist/server/snapshot_writer.mjs.map +1 -0
  143. package/dist/server/suite.mjs +82 -0
  144. package/dist/server/suite.mjs.map +1 -0
  145. package/dist/server/vis_options.mjs +19 -0
  146. package/dist/server/vis_options.mjs.map +1 -0
  147. package/dist/server/vis_server_context.deps.mjs +16 -0
  148. package/dist/server/vis_server_context.deps.mjs.map +1 -0
  149. package/dist/server/vis_server_context.logic.mjs +82 -0
  150. package/dist/server/vis_server_context.logic.mjs.map +1 -0
  151. package/dist/server/vis_server_context.mjs +8 -0
  152. package/dist/server/vis_server_context.mjs.map +1 -0
  153. package/dist/server/vis_server_context.types.d.mts +2 -0
  154. package/dist/server-utils.d.mts +4 -19
  155. package/dist/server-utils.mjs +3 -2
  156. package/dist/setup/create_vis.d.mts +108 -0
  157. package/dist/setup/create_vis.d.mts.map +1 -0
  158. package/dist/setup/create_vis.mjs +58 -0
  159. package/dist/setup/create_vis.mjs.map +1 -0
  160. package/dist/setup/vis.d.mts +10 -0
  161. package/dist/setup/vis.d.mts.map +1 -0
  162. package/dist/setup/vis.mjs +12 -0
  163. package/dist/setup/vis.mjs.map +1 -0
  164. package/dist/setup-api.d.mts +4 -0
  165. package/dist/setup-api.mjs +5 -0
  166. package/dist/setup.d.mts +8 -105
  167. package/dist/setup.d.mts.map +1 -1
  168. package/dist/setup.mjs +12 -7
  169. package/dist/setup.mjs.map +1 -0
  170. package/dist/{asserts--HSSlgPD.mjs → shared/asserts.mjs} +2 -2
  171. package/dist/shared/asserts.mjs.map +1 -0
  172. package/dist/{base64-CHSENEAO.mjs → shared/base64.mjs} +2 -2
  173. package/dist/shared/base64.mjs.map +1 -0
  174. package/dist/shared/commands.types.d.mts +51 -0
  175. package/dist/shared/commands.types.d.mts.map +1 -0
  176. package/dist/shared/compare_image.mjs +46 -0
  177. package/dist/shared/compare_image.mjs.map +1 -0
  178. package/dist/shared/constants.d.mts +9 -0
  179. package/dist/shared/constants.d.mts.map +1 -0
  180. package/dist/{constants-CTBaz8Ml.mjs → shared/constants.mjs} +2 -2
  181. package/dist/shared/constants.mjs.map +1 -0
  182. package/dist/shared/convert_threshold_unit.mjs +12 -0
  183. package/dist/shared/convert_threshold_unit.mjs.map +1 -0
  184. package/dist/shared/get_max_size.mjs +11 -0
  185. package/dist/shared/get_max_size.mjs.map +1 -0
  186. package/dist/shared/is_same_size.mjs +8 -0
  187. package/dist/shared/is_same_size.mjs.map +1 -0
  188. package/dist/{trim_common_folder-ModiubEJ.d.mts → shared/trim_common_folder.d.mts} +2 -2
  189. package/dist/shared/trim_common_folder.d.mts.map +1 -0
  190. package/dist/shared/trim_common_folder.mjs +23 -0
  191. package/dist/shared/trim_common_folder.mjs.map +1 -0
  192. package/dist/{types-DFb23VE1.d.mts → shared/types.d.mts} +39 -20
  193. package/dist/shared/types.d.mts.map +1 -0
  194. package/dist/testing/constants.d.mts +12 -0
  195. package/dist/testing/constants.d.mts.map +1 -0
  196. package/dist/testing/constants.mjs +65550 -0
  197. package/dist/{testing.mjs.map → testing/constants.mjs.map} +1 -1
  198. package/dist/testing.d.mts +2 -12
  199. package/dist/testing.mjs +2 -65549
  200. package/package.json +24 -17
  201. package/readme.md +48 -3
  202. package/src/{client/ctx.ts → auto_snapshots/_ctx.ts} +1 -3
  203. package/src/auto_snapshots/_extract_auto_snapshot_options.ts +26 -0
  204. package/src/{client → auto_snapshots}/auto_snapshot_options.mdx +1 -2
  205. package/src/{client → auto_snapshots}/auto_snapshot_options.ts +1 -23
  206. package/src/client/actions/has_image_snapshot_action.ts +1 -1
  207. package/src/client/actions/load_image_snapshot_results_action.ts +1 -1
  208. package/src/client/actions/match_image_snapshot_action.ts +6 -6
  209. package/src/client/actions/match_page_image_snapshot_action.ts +5 -3
  210. package/src/client/expect/_ctx.ts +10 -0
  211. package/src/client/expect/to_match_image_snapshot.ts +3 -4
  212. package/src/client/external/browser/has_render_content.ts +3 -0
  213. package/src/client/{image_resizer.ts → external/browser/image_resizer.ts} +1 -1
  214. package/src/client/{vitest_suite_proxy.ts → external/vitest/vitest_suite_proxy.ts} +1 -1
  215. package/src/client/{align_images.ts → image/align_images.ts} +3 -3
  216. package/src/client/page/_ctx.ts +12 -0
  217. package/src/client/page/has_image_snapshot.ts +4 -4
  218. package/src/client/page/to_match_image_snapshot.ts +3 -4
  219. package/src/client/{compare_image_snapshot.logic.ts → snapshot/compare_image_snapshot.logic.ts} +2 -2
  220. package/src/client/{compare_image_snapshot.ts → snapshot/compare_image_snapshot.ts} +23 -10
  221. package/src/client/snapshot/should_take_snapshot.ts +6 -0
  222. package/src/client/suite/_ctx.ts +8 -0
  223. package/src/client/suite/auto_snapshot_matcher.ts +67 -0
  224. package/src/client-api.ts +3 -2
  225. package/src/config/overview.mdx +145 -0
  226. package/src/{shared → config}/trim_common_folder.mdx +1 -1
  227. package/src/config/types.ts +5 -6
  228. package/src/config/vis.mdx +313 -0
  229. package/src/index.ts +1 -1
  230. package/src/overview.mdx +66 -28
  231. package/src/server/commands/augment.ts +8 -6
  232. package/src/server/commands/has_image_snapshot.ts +1 -4
  233. package/src/server/commands/image_snapshot_next_index.ts +1 -7
  234. package/src/server/commands/load_image_snapshot_results.ts +1 -20
  235. package/src/server/commands/prepare_image_snapshot_comparison.ts +10 -56
  236. package/src/server/commands/prepare_page_image_snapshot_comparison.ts +2 -49
  237. package/src/server/commands/setup_vis_suite.ts +0 -24
  238. package/src/server/snapshot_path.ts +3 -1
  239. package/src/server/vis_server_context.logic.ts +1 -1
  240. package/src/{setup.create_vis.mdx → setup/create_vis.mdx} +4 -5
  241. package/src/{client/setup → setup}/create_vis.ts +31 -83
  242. package/src/setup/overview.mdx +17 -0
  243. package/src/setup/readme.md +7 -0
  244. package/src/{setup.vis.mdx → setup/vis.mdx} +15 -18
  245. package/src/setup-api.ts +5 -0
  246. package/src/setup.ts +9 -5
  247. package/src/shared/commands.types.ts +71 -0
  248. package/src/shared/types.ts +54 -1
  249. package/dist/asserts--HSSlgPD.mjs.map +0 -1
  250. package/dist/augment-BJmy1S7i.d.mts +0 -31
  251. package/dist/augment-BJmy1S7i.d.mts.map +0 -1
  252. package/dist/auto_snapshot_options-CAD43Zkp.mjs.map +0 -1
  253. package/dist/auto_snapshot_options-CaQCXDdi.d.mts.map +0 -1
  254. package/dist/base64-CHSENEAO.mjs.map +0 -1
  255. package/dist/client-api.d.mts.map +0 -1
  256. package/dist/client-api.mjs.map +0 -1
  257. package/dist/config.d.mts.map +0 -1
  258. package/dist/config.mjs.map +0 -1
  259. package/dist/constants-CTBaz8Ml.mjs.map +0 -1
  260. package/dist/server-utils.d.mts.map +0 -1
  261. package/dist/setup-BWgIDtv-.mjs +0 -141
  262. package/dist/setup-BWgIDtv-.mjs.map +0 -1
  263. package/dist/setup_vis_suite-C6JGGT7B.d.mts +0 -17
  264. package/dist/setup_vis_suite-C6JGGT7B.d.mts.map +0 -1
  265. package/dist/snapshot_path-7GliOSH_.mjs.map +0 -1
  266. package/dist/src-CSQnlFa9.mjs +0 -1
  267. package/dist/task_id-DnS9_4Ub.mjs +0 -316
  268. package/dist/task_id-DnS9_4Ub.mjs.map +0 -1
  269. package/dist/testing.d.mts.map +0 -1
  270. package/dist/to_match_image_snapshot.types-p-zilA_M.d.mts.map +0 -1
  271. package/dist/trim_common_folder-ModiubEJ.d.mts.map +0 -1
  272. package/dist/types-DFb23VE1.d.mts.map +0 -1
  273. package/dist/types-Do1N7g4c.d.mts.map +0 -1
  274. package/dist/vis_server_context.types-Ce1f9vOO.d.mts +0 -1
  275. package/src/client/image_snapshot_options.ts +0 -6
  276. package/src/client/setup/vis.ctx.ts +0 -34
  277. package/src/client/should_take_snapshot.ts +0 -5
  278. package/src/config.vis.mdx +0 -76
  279. package/src/server/commands/types.ts +0 -9
  280. /package/src/{client → auto_snapshots}/snapshot_meta.ts +0 -0
  281. /package/src/client/{image_data.ts → external/browser/image_data.ts} +0 -0
  282. /package/src/client/{selector.ts → external/browser/selector.ts} +0 -0
  283. /package/src/client/{vitest_browser_context_proxy.ts → external/vitest/vitest_browser_context_proxy.ts} +0 -0
  284. /package/src/client/{task_id.ts → task/task_id.ts} +0 -0
  285. /package/src/{client/setup → setup}/vis.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import type pixelMatch from 'pixelmatch'
2
2
  import type { Options as SsimDiffOptions } from 'ssim.js'
3
- import type { SnapshotMeta } from '../client/snapshot_meta.ts'
3
+ import type { SnapshotMeta } from '../auto_snapshots/snapshot_meta.ts'
4
4
  import type { NAME } from './constants.ts'
5
5
 
6
6
  export type Awaitable<T> = T | PromiseLike<T>
@@ -108,3 +108,56 @@ export type SnapshotTestMeta = {
108
108
  [NAME]?: SnapshotMeta<ComparisonMethod>
109
109
  }
110
110
  }
111
+
112
+ export type ImageSnapshotComparisonInfo = {
113
+ /**
114
+ * Path to the project root.
115
+ */
116
+ projectRoot: string
117
+ /**
118
+ * Path to the baseline image relative to the project root.
119
+ */
120
+ baselinePath: string
121
+ /**
122
+ * Path to the result image relative to the project root.
123
+ */
124
+ resultPath: string
125
+ /**
126
+ * Path to the diff image relative to the project root.
127
+ */
128
+ diffPath: string
129
+ /**
130
+ * Base64 encoded baseline image.
131
+ * Undefined if the baseline image does not exist.
132
+ */
133
+ baseline?: string | undefined
134
+ /**
135
+ * Base64 encoded result image.
136
+ */
137
+ result: string
138
+ /**
139
+ * Base64 encoded diff image.
140
+ */
141
+ diff?: string | undefined
142
+ } & ImageSnapshotTimeoutOptions &
143
+ FailureThresholdOptions &
144
+ (SsimComparisonOptions | PixelComparisonOptions)
145
+
146
+ export type MatchImageSnapshotOptions = ImageSnapshotTimeoutOptions &
147
+ ImageSnapshotCompareOptions<any> &
148
+ ImageSnapshotKeyOptions
149
+
150
+ export type SetupVisOptions<GM extends Record<string, any> | unknown = unknown> = {
151
+ auto?:
152
+ | boolean
153
+ | (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(
154
+ options: SnapshotMeta<C> & M & GM,
155
+ ) => Promise<boolean> | Promise<void> | boolean | void)
156
+ | Record<
157
+ string,
158
+ | boolean
159
+ | (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(
160
+ options: SnapshotMeta<C> & M & GM,
161
+ ) => Promise<boolean> | Promise<void> | boolean | void)
162
+ >
163
+ }
@@ -1 +0,0 @@
1
- {"version":3,"file":"asserts--HSSlgPD.mjs","names":[],"sources":["../src/shared/asserts.ts"],"sourcesContent":["export function assertSnapshotKeyWithoutDash(snapshotKey: string | undefined) {\n\tif (snapshotKey?.includes('-')) {\n\t\tthrow new Error('Snapshot key cannot contain dash')\n\t}\n}\n"],"mappings":";AAAA,SAAgB,6BAA6B,aAAiC;AAC7E,KAAI,aAAa,SAAS,IAAI,CAC7B,OAAM,IAAI,MAAM,mCAAmC"}
@@ -1,31 +0,0 @@
1
- import { a as ImageSnapshotKeyOptions, h as ToMatchPageImageSnapshotOptions, n as ComparisonMethod } from "./types-DFb23VE1.mjs";
2
- import { t as ImageSnapshotMatcher } from "./to_match_image_snapshot.types-p-zilA_M.mjs";
3
- import { BrowserPage } from "vitest/browser";
4
-
5
- //#region src/client/expect/augment.d.ts
6
- declare global {
7
- namespace jest {
8
- interface Matchers<R, T> extends ImageSnapshotMatcher {}
9
- }
10
- }
11
- //# sourceMappingURL=augment.d.ts.map
12
- //#endregion
13
- //#region src/client/page/has_image_snapshot.d.ts
14
- interface HasImageSnapshotAction {
15
- /**
16
- * Check if the snapshot image exists.
17
- */
18
- hasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined): Promise<boolean>;
19
- }
20
- //#endregion
21
- //#region src/client/page/to_match_image_snapshot.d.ts
22
- interface ToMatchImageSnapshotAction {
23
- toMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(options?: ToMatchPageImageSnapshotOptions<M> | undefined): Promise<void>;
24
- }
25
- //#endregion
26
- //#region src/client/page/augment.d.ts
27
- declare module '@vitest/browser/context' {
28
- interface BrowserPage extends HasImageSnapshotAction, ToMatchImageSnapshotAction {}
29
- }
30
- //# sourceMappingURL=augment.d.ts.map
31
- //# sourceMappingURL=augment-BJmy1S7i.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"augment-BJmy1S7i.d.mts","names":[],"sources":["../src/client/expect/augment.ts","../src/client/page/has_image_snapshot.ts","../src/client/page/to_match_image_snapshot.ts","../src/client/page/augment.ts"],"sourcesContent":[],"mappings":";;;;;;;qCAKmC;EAL2C;;;;;UCM7D,sBAAA;;;ADN6D;EAAA,gBAAA,CAAA,IAAA,ECUtD,WDVsD,EAAA,OAAA,CAAA,ECU/B,uBDV+B,GAAA,SAAA,CAAA,ECUO,ODVP,CAAA,OAAA,CAAA;;;;UEM7D,0BAAA;iCACe,sCACpB,gCAAgC,iBACxC;;;;;gCCL2B,wBAAwB;AHJuB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"auto_snapshot_options-CAD43Zkp.mjs","names":["vitestSuite: Awaited<typeof import('vitest/suite')>","list: any[]"],"sources":["../src/client/vitest_suite_proxy.ts","../src/client/ctx.ts","../src/client/auto_snapshot_options.ts"],"sourcesContent":["import type { SnapshotTestMeta } from '../shared/types.ts'\n\nlet vitestSuite: Awaited<typeof import('vitest/suite')>\n\nif ((globalThis as any).__vitest_browser__) {\n\timport('vitest/suite').then((m) => {\n\t\tvitestSuite = m\n\t})\n}\n\nexport type CurrentTest = ReturnType<typeof vitestSuite.getCurrentTest> & SnapshotTestMeta\n\nexport const getCurrentTest = () => vitestSuite?.getCurrentTest() as CurrentTest\nexport const getCurrentSuite = () => vitestSuite?.getCurrentSuite()\n","import { getCurrentSuite, getCurrentTest } from './vitest_suite_proxy.ts'\n\nexport const ctx = {\n\tautoEnabled: undefined as boolean | undefined,\n\tgetCurrentTest,\n\tgetCurrentSuite,\n\t__test__reset() {\n\t\tctx.getCurrentTest = getCurrentTest\n\t\tctx.getCurrentSuite = getCurrentSuite\n\t\tctx.autoEnabled = undefined\n\t},\n}\n","import { assertSnapshotKeyWithoutDash } from '../shared/asserts.ts'\nimport { NAME } from '../shared/constants.ts'\nimport type { ComparisonMethod } from '../shared/types.ts'\nimport { ctx } from './ctx.ts'\nimport type { SnapshotMeta } from './snapshot_meta.ts'\n\ntype Suite = { meta: Record<string, any>; suite?: Suite | undefined }\n\nexport type MetaTask =\n\t| {\n\t\t\tfile?: { meta: Record<string, any> } | undefined\n\t\t\tsuite?: Suite | undefined\n\t\t\tmeta: Record<string, any>\n\t }\n\t| undefined\n\n/**\n * Set the snapshot options for auto snapshot.\n *\n * You can use it in beforeAll, beforeEach, or individual test cases.\n *\n * @param meta - The snapshot options to set.\n * You can pass a boolean to enable/disable the snapshot, or an object with the snapshot options.\n * When passing an object, the `enable` property will be set to `true` by default unless you explicitly set it to `false`.\n * @param meta.enable - Whether to enable the snapshot.\n * @param meta.snapshotKey - The key to use for the snapshot.\n * @param meta.comparisonMethod - The comparison method to use for the snapshot.\n * @param meta.diffOptions - The diff options to use for the snapshot.\n * @param meta.failureThreshold - The failure threshold to use for the snapshot.\n * @param meta.failureThresholdType - The failure threshold type to use for the snapshot.\n * @param meta.timeout - The timeout to use for the snapshot.\n *\n * @example\n *\n * ```ts\n * beforeAll(() => setAutoSnapshotOptions(...))\n * beforeEach(() => setAutoSnapshotOptions(...))\n *\n * it('...', () => {\n * setAutoSnapshotOptions(...)\n * })\n * ```\n */\nexport function setAutoSnapshotOptions<M extends ComparisonMethod>(meta: boolean | SnapshotMeta<M>): void {\n\tif (typeof meta === 'object') {\n\t\tassertSnapshotKeyWithoutDash(meta.snapshotKey)\n\t}\n\n\tconst task = getTask()\n\tif (!task) return\n\n\ttask.meta[NAME] = {\n\t\t...task.meta[NAME],\n\t\t...parseMeta(meta),\n\t}\n}\n\nfunction getTask(): MetaTask | undefined {\n\treturn ctx.getCurrentTest() ?? (ctx.getCurrentSuite()?.tasks?.[0] as any)?.file\n}\n\nfunction parseMeta<M extends ComparisonMethod>(meta: boolean | SnapshotMeta<M>): SnapshotMeta<M> {\n\treturn typeof meta === 'boolean' ? ({ enable: meta } as any) : { enable: true, ...meta }\n}\n\nexport function extractAutoSnapshotOptions<M extends SnapshotMeta<any> = SnapshotMeta<any>>(\n\ttask: MetaTask,\n): M | undefined {\n\tif (!task) return\n\n\tconst list: any[] = []\n\tlet current = task\n\twhile (current?.suite) {\n\t\tlist.unshift(current.suite.meta)\n\t\tcurrent = current.suite\n\t}\n\tlist.unshift(task.file?.meta)\n\tlist.push(task.meta)\n\treturn list.reduce(\n\t\t(acc, cur) => {\n\t\t\tconst meta = cur?.[NAME]\n\t\t\treturn meta ? Object.assign({}, acc, meta) : acc\n\t\t},\n\t\t{ enable: false },\n\t)\n}\n"],"mappings":";;;;AAEA,IAAIA;AAEJ,IAAK,WAAmB,mBACvB,QAAO,gBAAgB,MAAM,MAAM;AAClC,eAAc;EACb;AAKH,MAAa,uBAAuB,aAAa,gBAAgB;AACjE,MAAa,wBAAwB,aAAa,iBAAiB;;;;ACXnE,MAAa,MAAM;CAClB,aAAa;CACb;CACA;CACA,gBAAgB;AACf,MAAI,iBAAiB;AACrB,MAAI,kBAAkB;AACtB,MAAI,cAAc;;CAEnB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgCD,SAAgB,uBAAmD,MAAuC;AACzG,KAAI,OAAO,SAAS,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AA,SAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAnE,iCAAiC,kCAAkC,aAAa"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"base64-CHSENEAO.mjs","names":[],"sources":["../src/shared/base64.ts"],"sourcesContent":["export function isBase64String(value: unknown): value is string {\n\treturn typeof value === 'string' && /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/.test(value)\n}\n"],"mappings":";AAAA,SAAgB,eAAe,OAAiC;AAC/D,QAAO,OAAO,UAAU,YAAY,mEAAmE,KAAK,MAAM"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-api.d.mts","names":[],"sources":["../src/server/commands/has_image_snapshot.ts","../src/server/commands/image_snapshot_next_index.ts","../src/server/commands/load_image_snapshot_results.ts","../src/server/commands/types.ts","../src/server/commands/prepare_image_snapshot_comparison.ts","../src/server/commands/prepare_page_image_snapshot_comparison.ts","../src/server/commands/augment.ts","../src/client/actions/has_image_snapshot_action.ts","../src/client/actions/load_image_snapshot_results_action.ts","../src/client/actions/match_image_snapshot_action.ts","../src/client/actions/match_page_image_snapshot_action.ts","../src/client/expect/expectation_result.ts","../src/client/task_id.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;UAIiB,uBAAA;qEACmD;;;;UCDnD,6BAAA;;;;0CAIwB;;;;UCJxB,mBAAA;;;;;;;;;EFAA,MAAA,CAAA,EAAA,MAAA,GAAA,SAAuB;;;;ECAvB,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;;UCgBA,+BAAA;4CAC0B,QAAQ;AAjBnD;;;KCEY,yBAAA,GAA4B,8BACvC,mCACA;;;KCSW,6BAAA;;;;;;;AJbZ;;;;ACAA;;;;ACAA;EAgBiB,QAAA,EAAA,MAAA;;;;ECdL,QAAA,EAAA,MAAA;EAA4B;;;EAEhB,MAAA,EAAA,MAAA;;;;ECSZ,IAAA,CAAA,EAAA,MAAA,GAAA,SAAA;CA6BR,GAAA,2BAAA,GACH,uBADG,GAAA,CAEF,qBAFE,GAEsB,sBAFtB,CAAA;AACH,UAGgB,qCAAA,CAHhB;EACC,8BAAA,EAAA,CAAA,MAAA,EAAA,MAAA,EAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAMU,yBANV,GAAA,SAAA,EAAA,GAOI,OAPJ,CAOY,6BAPZ,GAAA,SAAA,CAAA;;;;KCjCG,2BAAA;;;;;;;ALXL;;;;ACAA;;;;ACAA;EAgBiB,QAAA,EAAA,MAAA;;;;ECdL,QAAA,EAAA,MAAA;EAA4B;;;EAEhB,MAAA,EAAA,MAAA;IEgCpB,8BACH,2BACC,wBAAwB;UAET,yCAAA;iEAGL,0CACN,QAAQ;AD/Bd;;;;oCERU,sBACP,+BACA,yBACA,2CACA,uCACA;;ANVH;;;iBODgB,sBAAA,WACL,gCAAgC,mDAEhC,sCAAmC;;;iBCJ9B,8BAAA,WAAyC,kDAA+C,QAAhB,mBAAA;;;iBCOlE,wBAAA,WACX,kBAAkB,wCAAwC,uEAG1D,mCAAgC;;;iBCNrB,4BAAA,WACX,kBAAkB,wCAAwC,yDAE1D,mCAAgC;;;cCR9B,SAAS;;;KCFjB,IAAA;;UAEI;;iBAGO,QAAA,OAAe"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"client-api.mjs","names":[],"sources":["../src/client/actions/load_image_snapshot_results_action.ts"],"sourcesContent":["import type { LoadImageSnapshotResultsCommand } from '../../server/commands/load_image_snapshot_results.ts'\n\nexport function loadImageSnapshotResultsAction(commands: LoadImageSnapshotResultsCommand, taskId: string) {\n\treturn commands.loadImageSnapshotResults(taskId)\n}\n"],"mappings":";;;;;;;AAEA,SAAgB,+BAA+B,UAA2C,QAAgB;AACzG,QAAO,SAAS,yBAAyB,OAAO"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../src/config/vis.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AAaA;;AAA8E,iBAA9D,GAA8D,CAAA,UAAhD,gBAAgD,GAAA,OAAA,CAAA,CAAA,OAAA,CAAA,EAAX,UAAW,CAAA,CAAA,CAAA,CAAA,EAAA;EAAX,IAAA,EAAA,MAAA;EAAU,MAGvD,CAAA,IAAA,EAAA,OAAA,EAAA,UAAA,EAHuD,KAAA,CAGvD,UAAA,CAAA,EAAA;IAAA,IAAA,EAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.mjs","names":["visOptions: Record<string, VisOptions<any> | undefined>","suites: VisSuites","visOptions","r: ImageSnapshotResult[]","r","visOptions","hasImageSnapshot: ExtendedBrowserCommand<Parameters<HasImageSnapshotCommand['hasImageSnapshot']>>","imageSnapshotNextIndex: ExtendedBrowserCommand<\n\tParameters<ImageSnapshotNextIndexCommand['imageSnapshotNextIndex']>\n>","loadImageSnapshotResults: ExtendedBrowserCommand<[taskId: string]>","mkdirp","writeFile","prepareImageSnapshotComparison: ExtendedBrowserCommand<\n\tParameters<PrepareImageSnapshotComparisonCommand['prepareImageSnapshotComparison']>\n>","preparePageImageSnapshotComparison: ExtendedBrowserCommand<\n\tParameters<PreparePageImageSnapshotComparisonCommand['preparePageImageSnapshotComparison']>\n>","setupVisSuite: ExtendedBrowserCommand<[]>"],"sources":["../src/server/externals/file.ts","../src/server/project.ts","../src/server/vis_options.ts","../src/server/vis_server_context.deps.ts","../src/server/suite.ts","../src/server/vis_server_context.logic.ts","../src/server/vis_server_context.ts","../src/server/commands/_assertions.ts","../src/server/commands/has_image_snapshot.ts","../src/server/commands/image_snapshot_next_index.ts","../src/server/commands/load_image_snapshot_results.ts","../src/server/browser_provider/playwright.ts","../src/server/browser_provider/webdriverio.ts","../src/server/browser_provider/browser_api.ts","../src/server/snapshot_writer.ts","../src/server/snapshot.ts","../src/server/commands/prepare_image_snapshot_comparison.ts","../src/server/commands/prepare_page_image_snapshot_comparison.ts","../src/server/commands/setup_vis_suite.ts","../src/server/commands/commands.ts","../src/config/vis.ts"],"sourcesContent":["import { glob, type GlobOptionsWithFileTypesUnset } from 'glob'\nimport { mkdirp } from 'mkdirp'\nimport { readFile, stat, writeFile } from 'node:fs/promises'\n\nexport const file = {\n\texistFile(filePath: string) {\n\t\treturn stat(filePath)\n\t\t\t.then((s) => s.isFile())\n\t\t\t.catch(() => false)\n\t},\n\tglob(pattern: string | string[], options?: GlobOptionsWithFileTypesUnset | undefined) {\n\t\treturn glob(pattern, options)\n\t},\n\tmkdirp: mkdirp as (path: string) => Promise<string | undefined>,\n\tasync tryReadFile(filePath: string | undefined): Promise<Buffer | undefined> {\n\t\tif (!filePath) return undefined\n\n\t\treturn readFile(filePath).catch(() => undefined)\n\t},\n\twriteFile,\n}\n","import type { ExtendedBrowserCommandContext } from './vis_server_context.types.ts'\n\nexport function getProjectName(context: ExtendedBrowserCommandContext) {\n\tconst { runner } = context.project\n\tconst name = runner.config.name\n\tif (typeof name === 'string') {\n\t\treturn name\n\t}\n\t// if (typeof name === 'object' && 'label' in name) {\n\t// \treturn (name as { label: string }).label\n\t// }\n\treturn undefined\n}\n\nexport function getProjectRoot(context: { project: { config: { root: string } } }) {\n\treturn context.project.config.root\n}\n","import type { TestUserConfig } from 'vitest/node'\nimport type { VisOptions } from '../config/types.ts'\nimport { assertSnapshotKeyWithoutDash } from '../shared/asserts.ts'\nimport { getProjectName } from './project.ts'\nimport type { ExtendedBrowserCommandContext } from './vis_server_context.types.ts'\n\nconst DEFAULT_PROJECT_NAME = '__default'\n\nconst visOptions: Record<string, VisOptions<any> | undefined> = {}\n\nexport function setVisOption(\n\tuserConfig: { test?: { name?: TestUserConfig['name'] | undefined } },\n\toptions: VisOptions<any> | undefined,\n) {\n\tassertSnapshotKeyWithoutDash(options?.snapshotKey)\n\n\tconst name = userConfig.test?.name\n\tconst id = typeof name === 'string' ? name : typeof name === 'object' ? name?.label : DEFAULT_PROJECT_NAME\n\tvisOptions[id] = options\n}\n\nexport function getVisOption(context: ExtendedBrowserCommandContext) {\n\tconst id = getProjectName(context) ?? DEFAULT_PROJECT_NAME\n\treturn visOptions[id] ?? {}\n}\n","/* v8 ignore start */\nimport ci from 'is-ci'\nimport { rimraf } from 'rimraf'\n\nexport const deps = {\n\trimraf,\n\tgetSnapshotPlatform() {\n\t\treturn ci ? process.platform : 'local'\n\t},\n}\n/* v8 ignore end */\n","import { join, relative } from 'pathe'\nimport type { VisOptions } from '../config/types.ts'\nimport { BASELINE_DIR, DIFF_DIR, RESULT_DIR } from '../shared/constants.ts'\nimport { getProjectName, getProjectRoot } from './project.ts'\nimport { getSnapshotSubpath, resolveSnapshotRootDir } from './snapshot_path.ts'\nimport { getVisOption } from './vis_options.ts'\nimport { deps } from './vis_server_context.deps.ts'\nimport type { ExtendedBrowserCommandContext, VisSuite, VisSuites } from './vis_server_context.types.ts'\n\nconst suites: VisSuites = {}\n\n/**\n * Setup suite is called on each test file's beforeAll hook.\n * Test files include vitest test files and storybook story files.\n * It needs to make sure there is no race condition between the test files.\n */\nexport async function setupSuite(browserContext: ExtendedBrowserCommandContext) {\n\tconst suiteId = getSuiteId(browserContext)\n\tconst visOptions = getVisOption(browserContext)\n\n\tif (!suites[suiteId]) {\n\t\tsuites[suiteId] = createSuite(browserContext, visOptions)\n\t}\n\n\tconst suite = await suites[suiteId]\n\n\tconst { taskSubpath, baselineDir, diffDir, resultDir, tasks } = createModule(\n\t\tsuite,\n\t\tbrowserContext.testPath!,\n\t\tvisOptions,\n\t)\n\tsuite.modules[taskSubpath] = { baselineDir, diffDir, resultDir, tasks }\n\n\tawait Promise.allSettled([deps.rimraf(diffDir), deps.rimraf(resultDir)])\n\treturn {\n\t\tcomparisonMethod: visOptions.comparisonMethod,\n\t\tdiffOptions: visOptions.diffOptions,\n\t\tfailureThreshold: visOptions.failureThreshold,\n\t\tfailureThresholdType: visOptions.failureThresholdType,\n\t\tsnapshotKey: visOptions.snapshotKey,\n\t\tsubject: visOptions.subject,\n\t\ttimeout: visOptions.timeout,\n\t}\n}\n\n/**\n * Suite ID also contains the project name to make it unique\n * across different projects.\n */\nexport function getSuiteId(context: ExtendedBrowserCommandContext) {\n\treturn `${getProjectName(context)}/${context.project.config.name}`\n}\n\nasync function createSuite(\n\tbrowserContext: ExtendedBrowserCommandContext,\n\tvisOptions: Pick<VisOptions, 'snapshotRootDir' | 'subject'>,\n) {\n\t// console.log('visOptions', visOptions)\n\tconst snapshotRootDir = resolveSnapshotRootDir(browserContext, visOptions)\n\tconst projectRoot = getProjectRoot(browserContext)\n\n\tconst state = {\n\t\tprojectRoot,\n\t\ttestTimeout: browserContext.project.config.testTimeout,\n\t\thookTimeout: browserContext.project.config.hookTimeout,\n\t\tsnapshotRootDir,\n\t\tsnapshotBaselineDir: join(snapshotRootDir, BASELINE_DIR),\n\t\tsnapshotResultDir: join(snapshotRootDir, RESULT_DIR),\n\t\tsnapshotDiffDir: join(snapshotRootDir, DIFF_DIR),\n\t\tsnapshotRootPath: join(projectRoot, snapshotRootDir),\n\t\tsubject: visOptions.subject,\n\t\tmodules: {},\n\t}\n\tawait Promise.allSettled([deps.rimraf(join(state.snapshotDiffDir)), deps.rimraf(join(state.snapshotResultDir))])\n\treturn state\n}\n\nexport function createModule(state: VisSuite, testPath: string, options: Pick<VisOptions, 'snapshotSubpath'>) {\n\tconst taskSubpath = getTaskSubpath(state, testPath, options)\n\treturn {\n\t\ttaskSubpath,\n\t\tbaselineDir: join(state.snapshotBaselineDir, taskSubpath),\n\t\tresultDir: join(state.snapshotResultDir, taskSubpath),\n\t\tdiffDir: join(state.snapshotDiffDir, taskSubpath),\n\t\ttasks: {},\n\t}\n}\n\nexport function getTaskSubpath(state: VisSuite, testPath: string, options: Pick<VisOptions, 'snapshotSubpath'>) {\n\treturn getSnapshotSubpath(relative(state.projectRoot, testPath), options)\n}\n\nexport function getSuite(context: ExtendedBrowserCommandContext) {\n\treturn suites[getSuiteId(context)]!\n}\n","import { basename, join, resolve } from 'pathe'\nimport { pick } from 'type-plus'\nimport type { ImageSnapshotKeyOptions } from '../client-api.ts'\nimport type { ImageSnapshotResult } from './commands/load_image_snapshot_results.ts'\nimport { file } from './externals/file.ts'\nimport { getSuite, getTaskSubpath } from './suite.ts'\nimport { getVisOption } from './vis_options.ts'\nimport type { ExtendedBrowserCommandContext } from './vis_server_context.types.ts'\n\nexport function createVisServerContext() {\n\tconst context = {\n\t\tasync getSnapshotResults(browserContext: ExtendedBrowserCommandContext, taskId: string) {\n\t\t\tconst suiteInfo = await context.getSuiteInfo(browserContext, taskId)\n\t\t\tconst baselines = await file.glob(join(suiteInfo.projectRoot, suiteInfo.baselineDir, `${suiteInfo.taskId}-*.png`))\n\t\t\tconst results = await file.glob(join(suiteInfo.projectRoot, suiteInfo.resultDir, `${suiteInfo.taskId}-*.png`))\n\t\t\tconst diffs = await file.glob(join(suiteInfo.projectRoot, suiteInfo.diffDir, `${suiteInfo.taskId}-*.png`))\n\n\t\t\tconst r: ImageSnapshotResult[] = []\n\t\t\tawait Promise.all(\n\t\t\t\tbaselines.map(async (baselinePath) => {\n\t\t\t\t\tconst filename = basename(baselinePath)\n\t\t\t\t\tconst resultPath = results.find((r) => r.endsWith(filename))\n\t\t\t\t\tconst diffPath = diffs.find((d) => d.endsWith(filename))\n\n\t\t\t\t\tconst baselineBuffer = await file.tryReadFile(baselinePath)\n\t\t\t\t\tconst resultBuffer = await file.tryReadFile(resultPath)\n\t\t\t\t\tconst diffBuffer = await file.tryReadFile(diffPath)\n\t\t\t\t\tr.push({\n\t\t\t\t\t\tfilename,\n\t\t\t\t\t\tbaseline: baselineBuffer?.toString('base64'),\n\t\t\t\t\t\tresult: resultBuffer?.toString('base64'),\n\t\t\t\t\t\tdiff: diffBuffer?.toString('base64'),\n\t\t\t\t\t})\n\t\t\t\t}),\n\t\t\t)\n\t\t\treturn r\n\t\t},\n\t\tasync getSnapshotInfo(\n\t\t\tbrowserContext: ExtendedBrowserCommandContext,\n\t\t\ttaskId: string,\n\t\t\toptions?: ImageSnapshotKeyOptions,\n\t\t) {\n\t\t\tconst suiteInfo = await context.getSuiteInfo(browserContext, taskId)\n\t\t\tconst snapshotFilename = context.getSnapshotFilename(browserContext, suiteInfo, options?.snapshotKey)\n\n\t\t\tconst { baselineDir, resultDir, diffDir, task } = suiteInfo\n\n\t\t\ttask.count = task.count + 1\n\t\t\tconst baselinePath = join(baselineDir, snapshotFilename)\n\t\t\tconst resultPath = join(resultDir, snapshotFilename)\n\t\t\tconst diffPath = join(diffDir, snapshotFilename)\n\n\t\t\treturn {\n\t\t\t\t...pick(\n\t\t\t\t\tgetVisOption(browserContext),\n\t\t\t\t\t'comparisonMethod',\n\t\t\t\t\t'diffOptions',\n\t\t\t\t\t'failureThreshold',\n\t\t\t\t\t'failureThresholdType',\n\t\t\t\t\t'timeout',\n\t\t\t\t),\n\t\t\t\tbaselinePath,\n\t\t\t\tresultPath,\n\t\t\t\tdiffPath,\n\t\t\t}\n\t\t},\n\n\t\tasync getTaskCount(browserContext: ExtendedBrowserCommandContext, taskId: string) {\n\t\t\treturn (await context.getSuiteInfo(browserContext, taskId)).task.count\n\t\t},\n\t\tasync hasImageSnapshot(\n\t\t\tbrowserContext: ExtendedBrowserCommandContext,\n\t\t\ttaskId: string,\n\t\t\tsnapshotKey: string | undefined,\n\t\t) {\n\t\t\tconst info = await context.getSuiteInfo(browserContext, taskId)\n\n\t\t\treturn file.existFile(\n\t\t\t\tresolve(info.projectRoot, info.baselineDir, context.getSnapshotFilename(browserContext, info, snapshotKey)),\n\t\t\t)\n\t\t},\n\t\tgetSnapshotFilename(\n\t\t\tbrowserContext: ExtendedBrowserCommandContext,\n\t\t\tinfo: { taskId: string; task: { count: number } },\n\t\t\tsnapshotKey: string | undefined,\n\t\t) {\n\t\t\tif (snapshotKey) return `${info.taskId}-${snapshotKey}.png`\n\t\t\tconst visOptions = getVisOption(browserContext)\n\t\t\tif (typeof visOptions.snapshotKey === 'string') {\n\t\t\t\treturn `${info.taskId}-${visOptions.snapshotKey}.png`\n\t\t\t}\n\t\t\treturn `${info.taskId}-${info.task.count}.png`\n\t\t},\n\t\tasync getSuiteInfo(browserContext: ExtendedBrowserCommandContext, taskId: string) {\n\t\t\tconst projectState = await getSuite(browserContext)\n\t\t\tconst visOptions = getVisOption(browserContext)\n\t\t\tconst moduleId = getTaskSubpath(projectState, browserContext.testPath, visOptions)\n\t\t\tconst m = projectState.modules[moduleId]!\n\t\t\tconst task = (m.tasks[taskId] = m.tasks[taskId] ?? { count: 1 })\n\t\t\treturn {\n\t\t\t\tprojectRoot: projectState.projectRoot,\n\t\t\t\tsuiteId: moduleId,\n\t\t\t\ttaskId,\n\t\t\t\tbaselineDir: m.baselineDir,\n\t\t\t\tresultDir: m.resultDir,\n\t\t\t\tdiffDir: m.diffDir,\n\t\t\t\ttask,\n\t\t\t}\n\t\t},\n\t}\n\treturn context\n}\n","import { createVisServerContext } from './vis_server_context.logic.ts'\n\nexport const visServerContext = createVisServerContext()\n","import { isAbsolute } from 'pathe'\nimport type { RequiredPick } from 'type-plus'\nimport type { ExtendedBrowserCommandContext } from '../vis_server_context.types.ts'\n\nexport function assertTestPathDefined(\n\tcontext: ExtendedBrowserCommandContext,\n\tcommandName: string,\n): asserts context is RequiredPick<ExtendedBrowserCommandContext, 'testPath'> {\n\tif (!context.testPath) {\n\t\tthrow new Error(`'commands.${commandName}' requires testPath to be defined`)\n\t}\n}\n\nexport function assertIsRelativePath(relativeFilePath: string, propName: string) {\n\tif (isAbsolute(relativeFilePath)) {\n\t\tthrow new Error(`'${propName}' must be a relative path`)\n\t}\n}\n","import { visServerContext } from '../vis_server_context.ts'\nimport type { ExtendedBrowserCommand } from '../vis_server_context.types.ts'\nimport { assertTestPathDefined } from './_assertions.ts'\n\nexport interface HasImageSnapshotCommand {\n\thasImageSnapshot(taskId: string, snapshotKey: string | undefined): Promise<boolean>\n}\n\nexport const hasImageSnapshot: ExtendedBrowserCommand<Parameters<HasImageSnapshotCommand['hasImageSnapshot']>> = async (\n\tcontext,\n\ttaskId,\n\tsnapshotKey,\n) => {\n\tassertTestPathDefined(context, 'hasImageSnapshot')\n\n\treturn visServerContext.hasImageSnapshot(context as any, taskId, snapshotKey)\n}\n","import { visServerContext } from '../vis_server_context.ts'\nimport type { ExtendedBrowserCommand } from '../vis_server_context.types.ts'\nimport { assertTestPathDefined } from './_assertions.ts'\n\nexport interface ImageSnapshotNextIndexCommand {\n\t/**\n\t * Get the index of the snapshot image to be created.\n\t */\n\timageSnapshotNextIndex(taskId: string): Promise<number>\n}\n\nexport const imageSnapshotNextIndex: ExtendedBrowserCommand<\n\tParameters<ImageSnapshotNextIndexCommand['imageSnapshotNextIndex']>\n> = async (context, taskId) => {\n\tassertTestPathDefined(context, 'imageSnapshotNextIndex')\n\n\treturn visServerContext.getTaskCount(context, taskId)\n}\n","import { visServerContext } from '../vis_server_context.ts'\nimport type { ExtendedBrowserCommand } from '../vis_server_context.types.ts'\nimport { assertTestPathDefined } from './_assertions.ts'\n\nexport interface ImageSnapshotResult {\n\tfilename: string\n\t/**\n\t * The base64 encoded image of the baseline snapshot.\n\t */\n\tbaseline?: string | undefined\n\t/**\n\t * The base64 encoded image of the result snapshot.\n\t */\n\tresult?: string | undefined\n\t/**\n\t * The base64 encoded image of the diff snapshot.\n\t */\n\tdiff?: string | undefined\n}\n\nexport interface LoadImageSnapshotResultsCommand {\n\tloadImageSnapshotResults(taskId: string): Promise<ImageSnapshotResult[]>\n}\n\nexport const loadImageSnapshotResults: ExtendedBrowserCommand<[taskId: string]> = async (\n\tcontext,\n\ttaskId,\n): Promise<ImageSnapshotResult[]> => {\n\tassertTestPathDefined(context, 'loadImageSnapshotResults')\n\treturn visServerContext.getSnapshotResults(context, taskId)\n}\n","import { resolve } from 'pathe'\nimport type { ExtendedBrowserCommandContext } from '../vis_server_context.types.ts'\nimport type { BrowserApi } from './types.ts'\n\nexport function playwright(context: ExtendedBrowserCommandContext): BrowserApi {\n\tconst { page, iframe } = context\n\n\treturn {\n\t\tasync takeScreenshot(projectRoot, relativeFilePath, selector, options) {\n\t\t\tconst subject = iframe.locator(selector)\n\t\t\treturn subject.screenshot({\n\t\t\t\tpath: resolve(projectRoot, relativeFilePath),\n\t\t\t\t...options,\n\t\t\t})\n\t\t},\n\t\tasync takePageScreenshot(projectRoot, relativeFilePath, options) {\n\t\t\treturn page.screenshot({\n\t\t\t\tpath: resolve(projectRoot, relativeFilePath),\n\t\t\t\t...options,\n\t\t\t})\n\t\t},\n\t}\n}\n","import type { ExtendedBrowserCommandContext } from '../vis_server_context.types.ts'\nimport type { BrowserApi } from './types.ts'\n\nexport function webdriverio(context: ExtendedBrowserCommandContext): BrowserApi {\n\tconst { browser } = context\n\treturn {\n\t\tasync takeScreenshot(_projectRoot, relativeFilePath, selector) {\n\t\t\tconst element = await browser.$(`${selector}`)\n\t\t\treturn element.saveScreenshot(relativeFilePath)\n\t\t},\n\t\tasync takePageScreenshot(_projectRoot, relativeFilePath, options) {\n\t\t\treturn browser.saveScreenshot(relativeFilePath, options)\n\t\t},\n\t}\n}\n","import type { ExtendedBrowserCommandContext } from '../vis_server_context.types.ts'\nimport { playwright } from './playwright.ts'\nimport { webdriverio } from './webdriverio.ts'\n\nexport function browserApi(context: ExtendedBrowserCommandContext) {\n\tif (context.provider.name === 'playwright') {\n\t\treturn playwright(context)\n\t}\n\tif (context.provider.name === 'webdriverio') {\n\t\treturn webdriverio(context)\n\t}\n\tthrow new Error(`Unsupported provider: ${context.provider.name}`)\n}\n","import { dirname } from 'pathe'\nimport { file } from './externals/file.ts'\n\nexport interface SnapshotWriter {\n\twriteBase64(filePath: string, data: string): Promise<void>\n\twriteBuffer(filePath: string, data: Buffer): Promise<void>\n}\n\nexport function createSnapshotWriter({ mkdirp, writeFile } = file): SnapshotWriter {\n\treturn {\n\t\tasync writeBase64(filePath: string, data: string) {\n\t\t\tawait mkdirp(dirname(filePath))\n\t\t\tawait writeFile(filePath, data, { encoding: 'base64' })\n\t\t},\n\t\tasync writeBuffer(filePath, data) {\n\t\t\tawait mkdirp(dirname(filePath))\n\t\t\tawait writeFile(filePath, data)\n\t\t},\n\t}\n}\n\nexport const snapshotWriter = createSnapshotWriter()\n","import { mkdirp } from 'mkdirp'\nimport { dirname, resolve } from 'pathe'\nimport { isBase64String } from '../shared/base64.ts'\nimport type { ImageSnapshotTimeoutOptions, PageImageSnapshotOptions } from '../shared/types.ts'\nimport { browserApi } from './browser_provider/browser_api.ts'\nimport { snapshotWriter } from './snapshot_writer.ts'\nimport type { ExtendedBrowserCommandContext } from './vis_server_context.types.ts'\n\nexport async function takeSnapshot(\n\tcontext: ExtendedBrowserCommandContext,\n\tprojectRoot: string,\n\trelativeFilePath: string,\n\tsubject: string,\n\toptions: ImageSnapshotTimeoutOptions | undefined,\n) {\n\tif (isBase64String(subject)) {\n\t\tawait snapshotWriter.writeBase64(resolve(projectRoot, relativeFilePath), subject)\n\t\treturn Buffer.from(subject, 'base64')\n\t}\n\treturn takeSnapshotByBrowser(context, projectRoot, relativeFilePath, subject, options)\n}\n\nexport async function takeSnapshotByBrowser(\n\tcontext: ExtendedBrowserCommandContext,\n\tprojectRoot: string,\n\trelativeFilePath: string,\n\tsubject: string,\n\toptions: ImageSnapshotTimeoutOptions | undefined,\n) {\n\tconst filePath = resolve(projectRoot, relativeFilePath)\n\tawait mkdirp(dirname(filePath))\n\tconst browser = browserApi(context)\n\treturn browser.takeScreenshot(projectRoot, relativeFilePath, subject ?? 'body', {\n\t\ttimeout: options?.timeout,\n\t})\n}\n\nexport async function takePageSnapshot(\n\tcontext: ExtendedBrowserCommandContext,\n\tprojectRoot: string,\n\trelativeFilePath: string,\n\toptions: (PageImageSnapshotOptions & ImageSnapshotTimeoutOptions) | undefined,\n) {\n\tconst filePath = resolve(projectRoot, relativeFilePath)\n\tawait mkdirp(dirname(filePath))\n\tconst browser = browserApi(context)\n\treturn browser.takePageScreenshot(projectRoot, relativeFilePath, {\n\t\ttimeout: options?.timeout,\n\t\tfullPage: options?.fullPage,\n\t})\n}\n","import { resolve } from 'pathe'\nimport { isBase64String } from '../../shared/base64.ts'\nimport type {\n\tFailureThresholdOptions,\n\tImageSnapshotTimeoutOptions,\n\tPixelComparisonOptions,\n\tSsimComparisonOptions,\n} from '../../shared/types.ts'\nimport { file } from '../externals/file.ts'\nimport { getProjectRoot } from '../project.ts'\nimport { takeSnapshot, takeSnapshotByBrowser } from '../snapshot.ts'\nimport { snapshotWriter } from '../snapshot_writer.ts'\nimport { visServerContext } from '../vis_server_context.ts'\nimport type { ExtendedBrowserCommand } from '../vis_server_context.types.ts'\nimport { assertTestPathDefined } from './_assertions.ts'\nimport type { MatchImageSnapshotOptions } from './types.ts'\n\nexport type ImageSnapshotComparisonInfo = {\n\t/**\n\t * Path to the project root.\n\t */\n\tprojectRoot: string\n\t/**\n\t * Path to the baseline image relative to the project root.\n\t */\n\tbaselinePath: string\n\t/**\n\t * Path to the result image relative to the project root.\n\t */\n\tresultPath: string\n\t/**\n\t * Path to the diff image relative to the project root.\n\t */\n\tdiffPath: string\n\t/**\n\t * Base64 encoded baseline image.\n\t */\n\tbaseline: string\n\t/**\n\t * Base64 encoded result image.\n\t */\n\tresult: string\n\t/**\n\t * Base64 encoded diff image.\n\t */\n\tdiff?: string | undefined\n} & ImageSnapshotTimeoutOptions &\n\tFailureThresholdOptions &\n\t(SsimComparisonOptions | PixelComparisonOptions)\n\nexport interface PrepareImageSnapshotComparisonCommand {\n\tprepareImageSnapshotComparison: (\n\t\ttaskId: string,\n\t\tsubject: string,\n\t\toptions?: MatchImageSnapshotOptions | undefined,\n\t) => Promise<ImageSnapshotComparisonInfo | undefined>\n}\n\nexport const prepareImageSnapshotComparison: ExtendedBrowserCommand<\n\tParameters<PrepareImageSnapshotComparisonCommand['prepareImageSnapshotComparison']>\n> = async (context, taskId, subject, options): Promise<ImageSnapshotComparisonInfo | undefined> => {\n\tassertTestPathDefined(context, 'prepareImageSnapshotComparison')\n\t// vitest:browser passes in `null` when not defined\n\tif (!options) options = {}\n\toptions.timeout = options.timeout ?? 30000\n\n\tconst projectRoot = getProjectRoot(context)\n\tconst info = await visServerContext.getSnapshotInfo(context, taskId, options)\n\n\tconst baselineBuffer = await file.tryReadFile(resolve(projectRoot, info.baselinePath))\n\tif (!baselineBuffer) {\n\t\tif (isBase64String(subject)) {\n\t\t\tawait snapshotWriter.writeBase64(resolve(projectRoot, info.baselinePath), subject)\n\t\t} else {\n\t\t\tawait takeSnapshotByBrowser(context, projectRoot, info.baselinePath, subject, options)\n\t\t}\n\t\treturn\n\t}\n\n\tconst resultBuffer = await takeSnapshot(context, projectRoot, info.resultPath, subject, options)\n\treturn {\n\t\t...info,\n\t\tprojectRoot,\n\t\tbaseline: baselineBuffer.toString('base64'),\n\t\tresult: resultBuffer.toString('base64'),\n\t}\n}\n","import { resolve } from 'pathe'\nimport type {\n\tFailureThresholdOptions,\n\tImageSnapshotTimeoutOptions,\n\tPixelComparisonOptions,\n\tSsimComparisonOptions,\n} from '../../shared/types.ts'\nimport { file } from '../externals/file.ts'\nimport { getProjectRoot } from '../project.ts'\nimport { takePageSnapshot } from '../snapshot.ts'\nimport { visServerContext } from '../vis_server_context.ts'\nimport type { ExtendedBrowserCommand } from '../vis_server_context.types.ts'\nimport { assertTestPathDefined } from './_assertions.ts'\nimport type { MatchImageSnapshotOptions } from './types.ts'\n\ntype ImageSnapshotComparisonInfo = {\n\t/**\n\t * Path to the project root.\n\t */\n\tprojectRoot: string\n\t/**\n\t * Path to the baseline image relative to the project root.\n\t */\n\tbaselinePath: string\n\t/**\n\t * Path to the result image relative to the project root.\n\t */\n\tresultPath: string\n\t/**\n\t * Path to the diff image relative to the project root.\n\t */\n\tdiffPath: string\n\t/**\n\t * Base64 encoded baseline image.\n\t */\n\tbaseline: string\n\t/**\n\t * Base64 encoded result image.\n\t */\n\tresult: string\n} & ImageSnapshotTimeoutOptions &\n\tFailureThresholdOptions &\n\t(SsimComparisonOptions | PixelComparisonOptions)\n\nexport interface PreparePageImageSnapshotComparisonCommand {\n\tpreparePageImageSnapshotComparison: (\n\t\ttaskId: string,\n\t\toptions?: MatchImageSnapshotOptions | undefined,\n\t) => Promise<ImageSnapshotComparisonInfo | undefined>\n}\n\nexport const preparePageImageSnapshotComparison: ExtendedBrowserCommand<\n\tParameters<PreparePageImageSnapshotComparisonCommand['preparePageImageSnapshotComparison']>\n> = async (context, taskId, options) => {\n\tassertTestPathDefined(context, 'preparePageImageSnapshotComparison')\n\t// vitest:browser passes in `null` when not defined\n\tif (!options) options = {}\n\toptions.timeout = options.timeout ?? 30000\n\n\tconst projectRoot = getProjectRoot(context)\n\tconst info = await visServerContext.getSnapshotInfo(context, taskId, options)\n\tconst baselineBuffer = await file.tryReadFile(resolve(projectRoot, info.baselinePath))\n\tif (!baselineBuffer) {\n\t\tawait takePageSnapshot(context, projectRoot, info.baselinePath, options)\n\t\treturn\n\t}\n\n\tconst resultBuffer = await takePageSnapshot(context, projectRoot, info.resultPath, options)\n\treturn {\n\t\t...info,\n\t\tprojectRoot,\n\t\tbaseline: baselineBuffer.toString('base64'),\n\t\tresult: resultBuffer.toString('base64'),\n\t}\n}\n","import type { Pick } from 'type-plus'\nimport type { VisOptions } from '../../config/types.ts'\nimport { setupSuite } from '../suite.ts'\nimport type { ExtendedBrowserCommand, ExtendedBrowserCommandContext } from '../vis_server_context.types.ts'\nimport { assertTestPathDefined } from './_assertions.ts'\n\nexport interface SetupVisSuiteCommand {\n\t/**\n\t * Sets up the visual testing suite by cleaning up previous snapshot and diff output directories.\n\t * When this command is run for the first time,\n\t * it will remove the results and diffs directory of all suites.\n\t *\n\t * In subsequent runs, it will only remove the results and diffs directory of the current suite.\n\t */\n\tsetupVisSuite: () => Promise<\n\t\tPick<\n\t\t\tVisOptions,\n\t\t\t| 'comparisonMethod'\n\t\t\t| 'diffOptions'\n\t\t\t| 'failureThreshold'\n\t\t\t| 'failureThresholdType'\n\t\t\t| 'snapshotKey'\n\t\t\t| 'subject'\n\t\t\t| 'timeout'\n\t\t>\n\t>\n}\n\nexport const setupVisSuite: ExtendedBrowserCommand<[]> = async (context): Promise<{ subject: string | undefined }> => {\n\tassertTestPathDefined(context, 'setupVisSuite')\n\treturn setupSuite(context as unknown as ExtendedBrowserCommandContext)\n}\n","import { hasImageSnapshot } from './has_image_snapshot.ts'\nimport { imageSnapshotNextIndex } from './image_snapshot_next_index.ts'\nimport { loadImageSnapshotResults } from './load_image_snapshot_results.ts'\nimport { prepareImageSnapshotComparison } from './prepare_image_snapshot_comparison.ts'\nimport { preparePageImageSnapshotComparison } from './prepare_page_image_snapshot_comparison.ts'\nimport { setupVisSuite } from './setup_vis_suite.ts'\n\nexport const commands = {\n\tsetupVisSuite,\n\timageSnapshotNextIndex,\n\thasImageSnapshot,\n\tpreparePageImageSnapshotComparison,\n\tprepareImageSnapshotComparison,\n\tloadImageSnapshotResults,\n}\n","import type { Plugin } from 'vitest/config'\nimport { commands } from '../server/commands/commands.ts'\nimport { setVisOption } from '../server/vis_options.ts'\nimport { NAME } from '../shared/constants.ts'\nimport type { ComparisonMethod } from '../shared/types.ts'\nimport type { VisOptions } from './types.ts'\n\n/**\n * Create a Vite plugin for visual testing.\n *\n * If options are not provided, the plugin will use the default options,\n * which enables the `auto` preset.\n */\nexport function vis<M extends ComparisonMethod = 'pixel'>(options: VisOptions<M> = { preset: 'auto' } as any) {\n\treturn {\n\t\tname: NAME,\n\t\tconfig(this: unknown, userConfig) {\n\t\t\tsetVisOption(userConfig, options)\n\t\t\tconst preset = options?.preset\n\t\t\treturn {\n\t\t\t\ttest: {\n\t\t\t\t\tbrowser: {\n\t\t\t\t\t\tname: undefined,\n\t\t\t\t\t\tcommands: commands as any,\n\t\t\t\t\t},\n\t\t\t\t\tsetupFiles: preset && preset !== 'none' && preset !== 'custom' ? [`vitest-plugin-vis/presets/${preset}`] : [],\n\t\t\t\t},\n\t\t\t}\n\t\t},\n\t} satisfies Plugin\n}\n"],"mappings":";;;;;;;;;;;;;AAIA,MAAa,OAAO;CACnB,UAAU,UAAkB;AAC3B,SAAO,KAAK,SAAS,CACnB,MAAM,MAAM,EAAE,QAAQ,CAAC,CACvB,YAAY,MAAM;;CAErB,KAAK,SAA4B,SAAqD;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@@ -1 +0,0 @@
1
- {"version":3,"file":"constants-CTBaz8Ml.mjs","names":[],"sources":["../src/shared/constants.ts"],"sourcesContent":["export const NAME = 'vis'\nexport const SNAPSHOT_ROOT_DIR = '__vis__'\nexport const BASELINE_DIR = '__baselines__'\nexport const RESULT_DIR = '__results__'\nexport const DIFF_DIR = '__diffs__'\n"],"mappings":";AAAA,MAAa,OAAO;AACpB,MAAa,oBAAoB;AACjC,MAAa,eAAe;AAC5B,MAAa,aAAa;AAC1B,MAAa,WAAW"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"server-utils.d.mts","names":[],"sources":["../src/server/snapshot_path.ts"],"sourcesContent":[],"mappings":";;;;;;;;;;AA8BA;;;;;iBAAgB,kBAAA"}
@@ -1,141 +0,0 @@
1
- import { n as setAutoSnapshotOptions, r as ctx, t as extractAutoSnapshotOptions } from "./auto_snapshot_options-CAD43Zkp.mjs";
2
- import { a as hasImageSnapshotAction, i as matchImageSnapshotAction, n as success, r as matchPageImageSnapshotAction, t as toTaskId } from "./task_id-DnS9_4Ub.mjs";
3
- import dedent from "dedent";
4
- import { afterEach, beforeAll, expect } from "vitest";
5
- import { commands, page } from "vitest/browser";
6
-
7
- //#region src/client/expect/to_match_image_snapshot.ts
8
- function toMatchImageSnapshot$1(subject, options) {
9
- const test = ctx.getCurrentTest();
10
- if (!test) throw new Error("`toMatchImageSnapshot()` must be called in a test.");
11
- if (test.concurrent) throw new Error("`toMatchImageSnapshot()` cannot be called in a concurrent test because concurrent tests run at the same time in the same iframe and affect each other's environment.");
12
- return matchImageSnapshotAction(commands, toTaskId(test), subject, options).then(() => success);
13
- }
14
-
15
- //#endregion
16
- //#region src/client/expect/extend.ts
17
- expect.extend({ toMatchImageSnapshot: toMatchImageSnapshot$1 });
18
-
19
- //#endregion
20
- //#region src/client/page/has_image_snapshot.ts
21
- function hasImageSnapshot(options) {
22
- const test = ctx.getCurrentTest();
23
- if (!test) throw new Error("`hasImageSnapshot()` must be called in a test.");
24
- if (test.concurrent) throw new Error("`hasImageSnapshot()` cannot be called in a concurrent test because concurrent tests run at the same time in the same iframe and affect each other's environment. ");
25
- return hasImageSnapshotAction(commands, toTaskId(test), options);
26
- }
27
-
28
- //#endregion
29
- //#region src/client/page/to_match_image_snapshot.ts
30
- function toMatchImageSnapshot(options) {
31
- const test = ctx.getCurrentTest();
32
- if (!test) throw new Error("`toMatchImageSnapshot()` must be called in a test.");
33
- if (test.concurrent) throw new Error("`toMatchImageSnapshot()` cannot be called in a concurrent test because concurrent tests run at the same time in the same iframe and affect each other's environment.");
34
- return matchPageImageSnapshotAction(commands, toTaskId(test), options);
35
- }
36
-
37
- //#endregion
38
- //#region src/client/page/extend.ts
39
- page.extend({
40
- hasImageSnapshot,
41
- toMatchImageSnapshot
42
- });
43
-
44
- //#endregion
45
- //#region src/client/should_take_snapshot.ts
46
- function shouldTakeSnapshot(meta) {
47
- return document.body.childElementCount > 0 && meta?.enable;
48
- }
49
-
50
- //#endregion
51
- //#region src/client/setup/create_vis.ts
52
- function createVis(commands$1) {
53
- let subject;
54
- const vis$1 = {
55
- setup(options) {
56
- if (!options || options.auto === false) beforeAll(vis$1.beforeAll.setup);
57
- else beforeAll(async () => {
58
- await vis$1.beforeAll.setup();
59
- setAutoSnapshotOptions(true);
60
- });
61
- if (typeof options?.auto === "function") afterEach(vis$1.afterEach.matchPerTheme({ auto: options.auto }));
62
- else if (typeof options?.auto === "object") afterEach(vis$1.afterEach.matchPerTheme(options.auto));
63
- else afterEach(vis$1.afterEach.matchImageSnapshot);
64
- },
65
- presets: {
66
- enable() {
67
- beforeAll(vis$1.beforeAll.setup);
68
- afterEach(vis$1.afterEach.matchImageSnapshot);
69
- },
70
- manual() {
71
- beforeAll(vis$1.beforeAll.setup);
72
- },
73
- auto() {
74
- beforeAll(async () => {
75
- await vis$1.beforeAll.setup();
76
- setAutoSnapshotOptions(true);
77
- });
78
- afterEach(vis$1.afterEach.matchImageSnapshot);
79
- },
80
- theme(themes) {
81
- beforeAll(async () => {
82
- await vis$1.beforeAll.setup();
83
- setAutoSnapshotOptions(true);
84
- });
85
- afterEach(vis$1.afterEach.matchPerTheme(themes));
86
- }
87
- },
88
- beforeAll: { async setup() {
89
- subject = (await commands$1.setupVisSuite()).subject;
90
- } },
91
- afterEach: {
92
- async matchImageSnapshot() {
93
- return vis$1.afterEach.matchPerTheme({ async auto() {} })();
94
- },
95
- matchPerTheme(themes) {
96
- return async function matchImageSnapshot() {
97
- const test = ctx.getCurrentTest();
98
- if ((test?.result?.errors?.length ?? 0) > 0) return;
99
- const meta = extractAutoSnapshotOptions(test);
100
- if (!shouldTakeSnapshot(meta)) return;
101
- const errors = [];
102
- for (const themeId in themes) try {
103
- await new Promise((a) => setTimeout(a, 10));
104
- const theme = themes[themeId];
105
- if ((typeof theme === "function" ? await theme(meta) : theme) === false) continue;
106
- await test.context.expect(getSubject(meta?.subject ?? subject)).toMatchImageSnapshot({
107
- ...meta,
108
- snapshotKey: meta?.snapshotKey ?? themeId
109
- });
110
- } catch (error) {
111
- errors.push([themeId, error]);
112
- }
113
- if (errors.length > 0) {
114
- if (errors.length === 1) throw errors[0][1];
115
- const taskId = toTaskId(test);
116
- throw new AggregateError(errors, dedent`Snapshot \`${taskId}\` mismatched
117
-
118
- ${errors.map(([themeId, error]) => {
119
- return `Theme \`${themeId}\` failed: ${error.message}`;
120
- }).join("\n\n")}`);
121
- }
122
- };
123
- }
124
- }
125
- };
126
- return vis$1;
127
- }
128
- function getSubject(selectors) {
129
- return selectors ? document.querySelector(selectors) ?? document.body : document.body;
130
- }
131
-
132
- //#endregion
133
- //#region src/client/setup/vis.ts
134
- /**
135
- * Visual test configuration on the client side.
136
- */
137
- const vis = createVis(commands);
138
-
139
- //#endregion
140
- export { createVis as n, vis as t };
141
- //# sourceMappingURL=setup-BWgIDtv-.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup-BWgIDtv-.mjs","names":["toMatchImageSnapshot","subject: string | undefined","vis: VisClientConfigurator<GM>","vis","commands","errors: Array<[string, Error]>"],"sources":["../src/client/expect/to_match_image_snapshot.ts","../src/client/expect/extend.ts","../src/client/page/has_image_snapshot.ts","../src/client/page/to_match_image_snapshot.ts","../src/client/page/extend.ts","../src/client/should_take_snapshot.ts","../src/client/setup/create_vis.ts","../src/client/setup/vis.ts"],"sourcesContent":["import { commands } from 'vitest/browser'\nimport type { AsyncExpectationResult } from '@vitest/expect'\nimport type { ToMatchImageSnapshotOptions } from '../../shared/types.ts'\nimport { matchImageSnapshotAction } from '../actions/match_image_snapshot_action.ts'\nimport { ctx } from '../ctx.ts'\nimport { toTaskId } from '../task_id.ts'\nimport { success } from './expectation_result.ts'\n\nexport function toMatchImageSnapshot(\n\t/**\n\t * The element or locator to take the snapshot of,\n\t * or the base64 value of the image to compare against.\n\t */\n\tsubject: any,\n\toptions?: ToMatchImageSnapshotOptions | undefined,\n): AsyncExpectationResult {\n\tconst test = ctx.getCurrentTest()\n\tif (!test) {\n\t\tthrow new Error('`toMatchImageSnapshot()` must be called in a test.')\n\t}\n\n\tif (test.concurrent) {\n\t\tthrow new Error(\n\t\t\t'`toMatchImageSnapshot()` cannot be called in a concurrent test because ' +\n\t\t\t\t\"concurrent tests run at the same time in the same iframe and affect each other's environment.\",\n\t\t)\n\t}\n\n\treturn matchImageSnapshotAction(commands, toTaskId(test), subject, options).then(() => success)\n}\n","import { expect } from 'vitest'\nimport { toMatchImageSnapshot } from './to_match_image_snapshot.ts'\nimport './augment.ts'\n\nexpect.extend({ toMatchImageSnapshot })\n","import { type BrowserPage, commands } from 'vitest/browser'\nimport type { ImageSnapshotKeyOptions } from '../../shared/types.ts'\nimport { hasImageSnapshotAction } from '../actions/has_image_snapshot_action.ts'\nimport { ctx } from '../ctx.ts'\nimport { toTaskId } from '../task_id.ts'\n\nexport interface HasImageSnapshotAction {\n\t/**\n\t * Check if the snapshot image exists.\n\t */\n\thasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined): Promise<boolean>\n}\n\nexport function hasImageSnapshot(this: BrowserPage, options?: ImageSnapshotKeyOptions | undefined) {\n\tconst test = ctx.getCurrentTest()\n\tif (!test) {\n\t\tthrow new Error('`hasImageSnapshot()` must be called in a test.')\n\t}\n\n\tif (test.concurrent) {\n\t\tthrow new Error(\n\t\t\t'`hasImageSnapshot()` cannot be called in a concurrent test because ' +\n\t\t\t\t\"concurrent tests run at the same time in the same iframe and affect each other's environment. \",\n\t\t)\n\t}\n\treturn hasImageSnapshotAction(commands, toTaskId(test), options)\n}\n","import { commands } from 'vitest/browser'\nimport type { ComparisonMethod, ToMatchPageImageSnapshotOptions } from '../../shared/types.ts'\nimport { matchPageImageSnapshotAction } from '../actions/match_page_image_snapshot_action.ts'\nimport { ctx } from '../ctx.ts'\nimport { toTaskId } from '../task_id.ts'\n\nexport interface ToMatchImageSnapshotAction {\n\ttoMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(\n\t\toptions?: ToMatchPageImageSnapshotOptions<M> | undefined,\n\t): Promise<void>\n}\n\nexport function toMatchImageSnapshot<M extends ComparisonMethod = 'pixel'>(\n\toptions?: ToMatchPageImageSnapshotOptions<M> | undefined,\n) {\n\tconst test = ctx.getCurrentTest()\n\tif (!test) {\n\t\tthrow new Error('`toMatchImageSnapshot()` must be called in a test.')\n\t}\n\n\tif (test.concurrent) {\n\t\tthrow new Error(\n\t\t\t'`toMatchImageSnapshot()` cannot be called in a concurrent test because ' +\n\t\t\t\t\"concurrent tests run at the same time in the same iframe and affect each other's environment.\",\n\t\t)\n\t}\n\n\treturn matchPageImageSnapshotAction(commands, toTaskId(test), options)\n}\n","import { page } from 'vitest/browser'\nimport './augment.ts'\nimport { hasImageSnapshot } from './has_image_snapshot.ts'\nimport { toMatchImageSnapshot } from './to_match_image_snapshot.ts'\n\npage.extend({ hasImageSnapshot, toMatchImageSnapshot })\n","import type { SnapshotMeta } from './snapshot_meta.ts'\n\nexport function shouldTakeSnapshot(meta: SnapshotMeta<any> | undefined) {\n\treturn document.body.childElementCount > 0 && meta?.enable\n}\n","import dedent from 'dedent'\nimport { afterEach, beforeAll } from 'vitest'\nimport type { SetupVisSuiteCommand } from '../../server/commands/setup_vis_suite.ts'\nimport type { ComparisonMethod } from '../../shared/types.ts'\nimport { extractAutoSnapshotOptions, setAutoSnapshotOptions } from '../auto_snapshot_options.ts'\nimport { ctx } from '../ctx.ts'\nimport { shouldTakeSnapshot } from '../should_take_snapshot.ts'\nimport type { SnapshotMeta } from '../snapshot_meta.ts'\nimport { toTaskId } from '../task_id.ts'\n\nexport type SetupVisOptions<GM extends Record<string, any> | unknown = unknown> = {\n\tauto?:\n\t\t| boolean\n\t\t| (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(\n\t\t\t\toptions: SnapshotMeta<C> & M & GM,\n\t\t ) => Promise<boolean> | Promise<void> | boolean | void)\n\t\t| Record<\n\t\t\t\tstring,\n\t\t\t\t| boolean\n\t\t\t\t| (<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(\n\t\t\t\t\t\toptions: SnapshotMeta<C> & M & GM,\n\t\t\t\t ) => Promise<boolean> | Promise<void> | boolean | void)\n\t\t >\n}\n\n/**\n * Visual test configuration on the client side.\n */\nexport type VisClientConfigurator<GM extends Record<string, any> | unknown = unknown> = {\n\t/**\n\t * Setup the visual test configuration.\n\t *\n\t * @example\n\t * ```ts\n\t * // Setup with auto snapshot enabled\n\t * vis().setup({ auto: true })\n\t *\n\t * // Setup with auto snapshot disabled\n\t * vis().setup({ auto: false })\n\t *\n\t * // Same as `vis.setup({ auto: false })`\n\t * vis.setup()\n\t *\n\t * // Setup with auto snapshot determined by the test meta\n\t * vis.setup({\n\t * \tauto: async ({ meta }) => meta['darkOnly'],\n\t * })\n\t *\n\t * // Setup with multiple auto snapshots\n\t * vis.setup({\n\t * auto: {\n\t * async light() { document.body.classList.remove('dark') },\n\t * async dark() { document.body.classList.add('dark') },\n\t * }\n\t * })\n\t * ```\n\t */\n\tsetup(options?: SetupVisOptions<GM>): void\n\t/**\n\t * @deprecated Use `vis.setup()` instead.\n\t */\n\tpresets: {\n\t\t/**\n\t\t * @deprecated Use `vis.setup()` instead.\n\t\t *\n\t\t * Enable visual testing.\n\t\t *\n\t\t * auto snapshot is turned off by default.\n\t\t * You can specify the test to take a snapshot during `afterEach()` hook with `setAutoSnapshotOptions()`.\n\t\t */\n\t\tenable(): void\n\t\t/**\n\t\t * @deprecated Use `vis.setup()` instead.\n\t\t *\n\t\t * Enable visual testing.\n\t\t *\n\t\t * `setAutoSnapshotOptions` will have no effect in this preset.\n\t\t */\n\t\tmanual(): void\n\t\t/**\n\t\t * @deprecated Use `vis.setup()` instead.\n\t\t *\n\t\t * Enable automatic visual testing.\n\t\t *\n\t\t * This will take a snapshot after each test.\n\t\t */\n\t\tauto(): void\n\t\t/**\n\t\t * @deprecated Use `vis.setup()` instead.\n\t\t *\n\t\t * Enable automatic visual testing with multiple themes.\n\t\t *\n\t\t * This will take a snapshot after each test for each theme.\n\t\t *\n\t\t * @param themes A record of theme names and their setup functions.\n\t\t *\n\t\t * @example\n\t\t * ```ts\n\t\t * vis().presets.theme({\n\t\t * light() { document.body.classList.add('light') },\n\t\t * dark() { document.body.classList.add('dark') },\n\t\t * })\n\t\t * ```\n\t\t */\n\t\ttheme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(\n\t\t\tthemes: Record<\n\t\t\t\tstring,\n\t\t\t\tboolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)\n\t\t\t>,\n\t\t): void\n\t}\n\tbeforeAll: {\n\t\tsetup(): Promise<void>\n\t}\n\tafterEach: {\n\t\tmatchImageSnapshot(): Promise<void>\n\t\tmatchPerTheme<C extends ComparisonMethod, M extends Record<string, any> | unknown = unknown>(\n\t\t\tthemes: Record<\n\t\t\t\tstring,\n\t\t\t\tboolean | ((options: SnapshotMeta<C> & M & GM) => Promise<boolean> | Promise<void> | boolean | void)\n\t\t\t>,\n\t\t): () => Promise<void>\n\t}\n}\n\nexport function createVis<GM extends Record<string, any> | unknown = unknown>(commands: SetupVisSuiteCommand) {\n\tlet subject: string | undefined\n\n\tconst vis: VisClientConfigurator<GM> = {\n\t\tsetup(options) {\n\t\t\tif (!options || options.auto === false) {\n\t\t\t\tbeforeAll(vis.beforeAll.setup)\n\t\t\t} else {\n\t\t\t\tbeforeAll(async () => {\n\t\t\t\t\tawait vis.beforeAll.setup()\n\t\t\t\t\tsetAutoSnapshotOptions(true)\n\t\t\t\t})\n\t\t\t}\n\n\t\t\tif (typeof options?.auto === 'function') {\n\t\t\t\tafterEach(\n\t\t\t\t\tvis.afterEach.matchPerTheme({\n\t\t\t\t\t\tauto: options.auto,\n\t\t\t\t\t}),\n\t\t\t\t)\n\t\t\t} else if (typeof options?.auto === 'object') {\n\t\t\t\tafterEach(vis.afterEach.matchPerTheme(options.auto))\n\t\t\t} else {\n\t\t\t\tafterEach(vis.afterEach.matchImageSnapshot)\n\t\t\t}\n\t\t},\n\t\tpresets: {\n\t\t\tenable() {\n\t\t\t\tbeforeAll(vis.beforeAll.setup)\n\t\t\t\tafterEach(vis.afterEach.matchImageSnapshot)\n\t\t\t},\n\t\t\tmanual() {\n\t\t\t\tbeforeAll(vis.beforeAll.setup)\n\t\t\t},\n\t\t\tauto() {\n\t\t\t\tbeforeAll(async () => {\n\t\t\t\t\tawait vis.beforeAll.setup()\n\t\t\t\t\tsetAutoSnapshotOptions(true)\n\t\t\t\t})\n\t\t\t\tafterEach(vis.afterEach.matchImageSnapshot)\n\t\t\t},\n\t\t\ttheme(themes) {\n\t\t\t\tbeforeAll(async () => {\n\t\t\t\t\tawait vis.beforeAll.setup()\n\t\t\t\t\tsetAutoSnapshotOptions(true)\n\t\t\t\t})\n\t\t\t\tafterEach(vis.afterEach.matchPerTheme(themes))\n\t\t\t},\n\t\t},\n\t\tbeforeAll: {\n\t\t\tasync setup() {\n\t\t\t\tsubject = (await commands.setupVisSuite()).subject\n\t\t\t},\n\t\t},\n\t\tafterEach: {\n\t\t\tasync matchImageSnapshot() {\n\t\t\t\treturn vis.afterEach.matchPerTheme({ async auto() {} })()\n\t\t\t},\n\t\t\tmatchPerTheme(themes) {\n\t\t\t\treturn async function matchImageSnapshot() {\n\t\t\t\t\tconst test = ctx.getCurrentTest()\n\t\t\t\t\tif ((test?.result?.errors?.length ?? 0) > 0) return\n\n\t\t\t\t\tconst meta = extractAutoSnapshotOptions(test)\n\t\t\t\t\tif (!shouldTakeSnapshot(meta)) return\n\t\t\t\t\tconst errors: Array<[string, Error]> = []\n\t\t\t\t\tfor (const themeId in themes) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tawait new Promise((a) => setTimeout(a, 10))\n\t\t\t\t\t\t\tconst theme = themes[themeId]\n\t\t\t\t\t\t\tconst r = typeof theme === 'function' ? await theme(meta! as any) : theme\n\t\t\t\t\t\t\tif (r === false) continue\n\t\t\t\t\t\t\tawait test!.context.expect(getSubject(meta?.subject ?? subject)).toMatchImageSnapshot({\n\t\t\t\t\t\t\t\t...meta,\n\t\t\t\t\t\t\t\tsnapshotKey: meta?.snapshotKey ?? themeId,\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\terrors.push([themeId, error as Error])\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\t\tif (errors.length === 1) throw errors[0]![1]\n\t\t\t\t\t\tconst taskId = toTaskId(test!)\n\t\t\t\t\t\tthrow new AggregateError(\n\t\t\t\t\t\t\terrors,\n\t\t\t\t\t\t\tdedent`Snapshot \\`${taskId}\\` mismatched\n\n\t\t\t\t\t\t${errors\n\t\t\t\t\t\t\t.map(([themeId, error]) => {\n\t\t\t\t\t\t\t\treturn `Theme \\`${themeId}\\` failed: ${error.message}`\n\t\t\t\t\t\t\t})\n\t\t\t\t\t\t\t.join('\\n\\n')}`,\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t}\n\treturn vis\n}\n\nfunction getSubject(selectors: string | undefined) {\n\treturn selectors ? (document.querySelector(selectors) ?? document.body) : document.body\n}\n","import { commands } from 'vitest/browser'\nimport { createVis } from './create_vis.ts'\n\n/**\n * Visual test configuration on the client side.\n */\nexport const vis = createVis(commands)\n"],"mappings":";;;;;;;AAQA,SAAgBA,uBAKf,SACA,SACyB;CACzB,MAAM,OAAO,IAAI,gBAAgB;AACjC,KAAI,CAAC,KACJ,OAAM,IAAI,MAAM,qDAAqD;AAGtE,KAAI,KAAK,WACR,OAAM,IAAI,MACT,uKAEA;AAGF,QAAO,yBAAyB,UAAU,SAAS,KAAK,EAAE,SAAS,QAAQ,CAAC,WAAW,QAAQ;;;;;ACxBhG,OAAO,OAAO,EAAE,8CAAsB,CAAC;;;;ACSvC,SAAgB,iBAAoC,SAA+C;CAClG,MAAM,OAAO,IAAI,gBAAgB;AACjC,KAAI,CAAC,KACJ,OAAM,IAAI,MAAM,iDAAiD;AAGlE,KAAI,KAAK,WACR,OAAM,IAAI,MACT,oKAEA;AAEF,QAAO,uBAAuB,UAAU,SAAS,KAAK,EAAE,QAAQ;;;;;ACbjE,SAAgB,qBACf,SACC;CACD,MAAM,OAAO,IAAI,gBAAgB;AACjC,KAAI,CAAC,KACJ,OAAM,IAAI,MAAM,qDAAqD;AAGtE,KAAI,KAAK,WACR,OAAM,IAAI,MACT,uKAEA;AAGF,QAAO,6BAA6B,UAAU,SAAS,KAAK,EAAE,QAAQ;;;;;ACtBvE,KAAK,OAAO;CAAE;CAAkB;CAAsB,CAAC;;;;ACHvD,SAAgB,mBAAmB,MAAqC;AACvE,QAAO,SAAS,KAAK,oBAAoB,KAAK,MAAM;;;;;AC0HrD,SAAgB,UAA8D,YAAgC;CAC7G,IAAIC;CAEJ,MAAMC,QAAiC;EACtC,MAAM,SAAS;AACd,OAAI,CAAC,WAAW,QAAQ,SAAS,MAChC,WAAUC,MAAI,UAAU,MAAM;OAE9B,WAAU,YAAY;AACrB,UAAMA,MA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C1D,MAAO;AACjB,YAAM,KAAM,QAAQ,OAAO,WAAW,MAAM,WAAW,QAAQ,CAAC,CAAC,qBAAqB;OACrF,GAAG;OACH,aAAa,MAAM,eAAe;OAClC,CAAC;cACM,OAAO;AACf,aAAO,KAAK,CAAC,SAAS,MAAe,CAAC;;AAGxC,SAAI,OAAO,SAAS,GAAG;AACtB,UAAI,OAAO,WAAW,EAAG,OAAM,OAAO,GAAI;MAC1C,MAAM,SAAS,SAAS,KAAM;AAC9B,YAAM,IAAI,eACT,QACA,MAAM,cAAc,OAAO;;QAE1B,OACA,KAAK,CAAC,SAAS,WAAW;AAC1B,cAAO,WAAW,QAAQ,aAAa,MAAM;QAC5C,CACD,KAAK,OAAO,GACb;;;;GAIJ;EACD;AACD,QAAOF;;AAGR,SAAS,WAAW,WAA+B;AAClD,QAAO,YAAa,SAAS,cAAc,UAAU,IAAI,SAAS,OAAQ,SAAS;;;;;;;;AC7NpF,MAAa,MAAM,UAAU,SAAS"}
@@ -1,17 +0,0 @@
1
- import { t as VisOptions } from "./types-Do1N7g4c.mjs";
2
- import { Pick } from "type-plus";
3
-
4
- //#region src/server/commands/setup_vis_suite.d.ts
5
- interface SetupVisSuiteCommand {
6
- /**
7
- * Sets up the visual testing suite by cleaning up previous snapshot and diff output directories.
8
- * When this command is run for the first time,
9
- * it will remove the results and diffs directory of all suites.
10
- *
11
- * In subsequent runs, it will only remove the results and diffs directory of the current suite.
12
- */
13
- setupVisSuite: () => Promise<Pick<VisOptions, 'comparisonMethod' | 'diffOptions' | 'failureThreshold' | 'failureThresholdType' | 'snapshotKey' | 'subject' | 'timeout'>>;
14
- }
15
- //#endregion
16
- export { SetupVisSuiteCommand as t };
17
- //# sourceMappingURL=setup_vis_suite-C6JGGT7B.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"setup_vis_suite-C6JGGT7B.d.mts","names":[],"sources":["../src/server/commands/setup_vis_suite.ts"],"sourcesContent":[],"mappings":";;;;UAMiB,oBAAA;EAAA;;;;;;;uBAQK,QACpB,KACC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"snapshot_path-7GliOSH_.mjs","names":[],"sources":["../src/shared/trim_common_folder.ts","../src/server/snapshot_path.ts"],"sourcesContent":["/**\n * Trim off common folder such as `src` or `tests` from the test file path.\n * This is used to generate the default snapshot sub-path.\n */\nexport function trimCommonFolder(suiteName: string) {\n\tsuiteName = suiteName.replaceAll('..', '__')\n\tconst suiteDir = suiteName.split('/', 1)[0]!\n\tif (['tests', 'test', 'src', 'source', 'js', 'ts', 'lib'].includes(suiteDir))\n\t\treturn suiteName.slice(suiteDir.length + 1)\n\treturn suiteName\n}\n","import ci from 'is-ci'\nimport { platform } from 'node:process'\nimport type { VisOptions } from '../config/types.ts'\nimport { SNAPSHOT_ROOT_DIR } from '../shared/constants.ts'\nimport { trimCommonFolder } from '../shared/trim_common_folder.ts'\nimport type { ExtendedBrowserCommandContext } from './vis_server_context.types.ts'\n\nexport function resolveSnapshotRootDir(browserCommandContext: ExtendedBrowserCommandContext, options: VisOptions) {\n\tif (!options.snapshotRootDir) return getSnapshotRootDir(SNAPSHOT_ROOT_DIR)\n\tconst snapshotRootDir = options.snapshotRootDir\n\tif (typeof snapshotRootDir === 'string') return getSnapshotRootDir(snapshotRootDir)\n\tconst { config } = browserCommandContext.project.browser\n\treturn snapshotRootDir({\n\t\tci,\n\t\tbrowserName: config.browser.name,\n\t\tproviderName: browserCommandContext.provider.name,\n\t\tplatform,\n\t\tscreenshotFailures: config.browser.screenshotFailures,\n\t\tscreenshotDirectory: config.browser.screenshotDirectory,\n\t})\n}\n\n/**\n * Gets the root directory for storing snapshots.\n *\n * @param snapshotRootDir - Base directory for snapshots. Defaults to `__vis__`.\n * @returns The full snapshot root directory path, which includes a platform-specific subdirectory:\n * - When running in CI: `<snapshotRootDir>/<platform>` (e.g. `__vis__/linux`)\n * - When running locally: `<snapshotRootDir>/local`\n */\nexport function getSnapshotRootDir(snapshotRootDir = SNAPSHOT_ROOT_DIR) {\n\treturn `${snapshotRootDir}/${ci ? platform : 'local'}`\n}\n\nexport function getSnapshotSubpath(suiteName: string, options: Pick<VisOptions, 'snapshotSubpath'>) {\n\tconst snapshotSubpath = options.snapshotSubpath ?? (({ subpath }) => trimCommonFolder(subpath))\n\treturn snapshotSubpath({ subpath: suiteName })\n}\n"],"mappings":";;;;;;;;;AAIA,SAAgB,iBAAiB,WAAmB;AACnD,aAAY,UAAU,WAAW,MAAM,KAAK;CAC5C,MAAM,WAAW,UAAU,MAAM,KAAK,EAAE,CAAC;AACzC,KAAI;EAAC;EAAS;EAAQ;EAAO;EAAU;EAAM;EAAM;EAAM,CAAC,SAAS,SAAS,CAC3E,QAAO,UAAU,MAAM,SAAS,SAAS,EAAE;AAC5C,QAAO;;;;;ACFR,SAAgB,uBAAuB,uBAAsD,SAAqB;AACjH,KAAI,CAAC,QAAQ,gBAAiB,QAAO,mBAAmB,kBAAkB;CAC1E,MAAM,kBAAkB,QAAQ;AAChC,KAAI,OAAO,oBAAoB,SAAU,QAAO,mBAAmB,gBAAgB;CACnF,MAAM,EAAE,WAAW,sBAAsB,QAAQ;AACjD,QAAO,gBAAgB;EACtB;EACA,aAAa,OAAO,QAAQ;EAC5B,cAAc,sBAAsB,SAAS;EAC7C;EACA,oBAAoB,OAAO,QAAQ;EACnC,qBAAqB,OAAO,QAAQ;EACpC,CAAC;;;;;;;;;;AAWH,SAAgB,mBAAmB,kBAAkB,mBAAmB;AACvE,QAAO,GAAG,gBAAgB,GAAG,KAAK,WAAW;;AAG9C,SAAgB,mBAAmB,WAAmB,SAA8C;AAEnG,SADwB,QAAQ,qBAAqB,EAAE,cAAc,iBAAiB,QAAQ,GACvE,EAAE,SAAS,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- export { };