vitest-plugin-vis 2.3.2 → 2.4.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 (54) hide show
  1. package/esm/client/image_snapshot_matcher.d.ts +2 -2
  2. package/esm/client/image_snapshot_matcher.d.ts.map +1 -1
  3. package/esm/client/image_snapshot_matcher.js +3 -3
  4. package/esm/client/snapshot_options.js +1 -1
  5. package/esm/commands.d.ts +1 -2
  6. package/esm/commands.d.ts.map +1 -1
  7. package/esm/commands.js +1 -2
  8. package/esm/config/types.d.ts +3 -3
  9. package/esm/config/types.d.ts.map +1 -1
  10. package/esm/config/vis.d.ts +1 -2
  11. package/esm/config/vis.d.ts.map +1 -1
  12. package/esm/config/vis.js +4 -3
  13. package/esm/server/commands/browser_command_context.d.ts +14 -0
  14. package/esm/server/commands/browser_command_context.d.ts.map +1 -0
  15. package/esm/server/commands/browser_command_context.js +6 -0
  16. package/esm/server/commands/extend.d.ts +1 -3
  17. package/esm/server/commands/extend.d.ts.map +1 -1
  18. package/esm/server/commands/extend.js +0 -2
  19. package/esm/server/commands/has_image_snapshot.js +1 -1
  20. package/esm/server/commands/image_snapshot_next_index.js +1 -1
  21. package/esm/server/commands/match_image_snapshot.js +1 -1
  22. package/esm/server/commands/prepare_image_snapshot_comparison.d.ts +18 -0
  23. package/esm/server/commands/prepare_image_snapshot_comparison.d.ts.map +1 -1
  24. package/esm/server/commands/prepare_image_snapshot_comparison.js +8 -6
  25. package/esm/server/snapshot_path.js +2 -2
  26. package/esm/server/vis_context.d.ts +13 -12
  27. package/esm/server/vis_context.d.ts.map +1 -1
  28. package/esm/server/vis_context.logic.d.ts +16 -15
  29. package/esm/server/vis_context.logic.d.ts.map +1 -1
  30. package/esm/server/vis_context.logic.js +51 -42
  31. package/esm/server/vis_context.types.d.ts +16 -6
  32. package/esm/server/vis_context.types.d.ts.map +1 -1
  33. package/esm/testing/stubBrowserCommandContext.d.ts.map +1 -1
  34. package/esm/testing/stubBrowserCommandContext.js +7 -0
  35. package/package.json +2 -1
  36. package/src/client/image_snapshot_matcher.ts +6 -6
  37. package/src/client/snapshot_options.ts +1 -1
  38. package/src/commands.ts +1 -2
  39. package/src/config/types.ts +3 -3
  40. package/src/config/vis.ts +5 -3
  41. package/src/server/commands/browser_command_context.ts +9 -0
  42. package/src/server/commands/extend.ts +0 -3
  43. package/src/server/commands/has_image_snapshot.ts +1 -1
  44. package/src/server/commands/image_snapshot_next_index.ts +1 -1
  45. package/src/server/commands/match_image_snapshot.ts +1 -1
  46. package/src/server/commands/prepare_image_snapshot_comparison.ts +26 -7
  47. package/src/server/snapshot_path.ts +2 -2
  48. package/src/server/vis_context.logic.ts +94 -45
  49. package/src/server/vis_context.types.ts +18 -7
  50. package/src/testing/stubBrowserCommandContext.ts +7 -0
  51. package/esm/server/commands/write_image_snapshot.d.ts +0 -12
  52. package/esm/server/commands/write_image_snapshot.d.ts.map +0 -1
  53. package/esm/server/commands/write_image_snapshot.js +0 -9
  54. package/src/server/commands/write_image_snapshot.ts +0 -26
@@ -1,26 +0,0 @@
1
- import { mkdirp } from 'mkdirp'
2
- import { dirname, isAbsolute } from 'pathe'
3
- import type { BrowserCommand } from 'vitest/node'
4
- import { file } from '../file.ts'
5
- import { assertIsRelativePath } from './_assertions.ts'
6
-
7
- export interface WriteImageSnapshotCommand {
8
- /**
9
- * Writes the image snapshot to the file system.
10
- * @param relativeFilePath The file path to write the image snapshot to.
11
- * It is relative to the project root.
12
- * @param imageBase64 The base64 encoded image.
13
- */
14
- writeImageSnapshot(relativeFilePath: string, imageBase64: string): Promise<void>
15
- }
16
-
17
- export const writeImageSnapshot: BrowserCommand<[relativeFilePath: string, imageBase64: string]> = async (
18
- _,
19
- relativeFilePath,
20
- imageBase64,
21
- ) => {
22
- assertIsRelativePath(relativeFilePath, 'relativeFilePath')
23
-
24
- await mkdirp(dirname(relativeFilePath))
25
- await file.writeFile(relativeFilePath, imageBase64, { encoding: 'base64' })
26
- }