@jsenv/snapshot 2.18.2 → 2.18.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/snapshot",
3
- "version": "2.18.2",
3
+ "version": "2.18.4",
4
4
  "type": "module",
5
5
  "description": "Snapshot testing",
6
6
  "repository": {
@@ -28,13 +28,13 @@
28
28
  ],
29
29
  "dependencies": {
30
30
  "@jsenv/assert": "4.5.7",
31
- "@jsenv/ast": "6.8.2",
31
+ "@jsenv/ast": "6.8.3",
32
32
  "@jsenv/exception": "1.2.1",
33
- "@jsenv/filesystem": "4.15.16",
34
- "@jsenv/humanize": "1.7.7",
35
- "@jsenv/terminal-recorder": "1.5.47",
33
+ "@jsenv/filesystem": "4.15.17",
34
+ "@jsenv/humanize": "1.7.8",
35
+ "@jsenv/terminal-recorder": "1.5.48",
36
36
  "@jsenv/url-meta": "8.5.7",
37
- "@jsenv/urls": "2.9.9",
37
+ "@jsenv/urls": "2.9.10",
38
38
  "@jsenv/utils": "2.3.1",
39
39
  "ansi-regex": "6.2.2",
40
40
  "pixelmatch": "7.2.0",
@@ -10,6 +10,10 @@ import { renderSideEffects, renderSmallLink } from "./render_side_effects.js";
10
10
 
11
11
  /**
12
12
  * Generate a markdown file describing test(s) side effects. When executed in CI throw if there is a diff.
13
+ *
14
+ * Options can be passed inline as the third argument or pre-configured with
15
+ * {@link snapshotTests.prefConfigure} to keep the call site formatting clean.
16
+ *
13
17
  * @param {URL} sourceFileUrl
14
18
  * @param {Function} fnRegisteringTest
15
19
  * @param {Object} snapshotTestsOptions
@@ -252,13 +256,23 @@ export const snapshotTests = async (
252
256
 
253
257
  return { dirUrlMap, sideEffectsMap };
254
258
  };
255
- // preConfigure is just so that when we update the snapshot test options
256
- // it does not influence too much the formatting
257
- // snapshotTests(import.meta.url, ({ test }) => { }, options)
258
- // becomes
259
- // snapshotTests.prefConfigure(options)
260
- // snapshotTests(import.meta.url, ({ test }) => { })
261
- // which are equivalent
259
+ /**
260
+ * Pre-configure options for the next {@link snapshotTests} call.
261
+ *
262
+ * Useful to avoid options cluttering the call site when options are declared
263
+ * separately or updated frequently. The pre-configured options are merged into
264
+ * the next `snapshotTests` call and then cleared, so they apply exactly once.
265
+ *
266
+ * @param {Object} options - Same options accepted by {@link snapshotTests}.
267
+ *
268
+ * @example
269
+ * // Instead of:
270
+ * snapshotTests(import.meta.url, ({ test }) => { }, options)
271
+ *
272
+ * // Write:
273
+ * snapshotTests.prefConfigure(options)
274
+ * snapshotTests(import.meta.url, ({ test }) => { })
275
+ */
262
276
  snapshotTests.prefConfigure = (options) => {
263
277
  preconfiguredOptions = options;
264
278
  };