quickpickle 1.10.0 → 1.11.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.
package/dist/world.d.ts CHANGED
@@ -2,9 +2,10 @@ import type { TestContext } from 'vitest';
2
2
  import type { QuickPickleConfig } from '.';
3
3
  import sanitize from './shims/path-sanitizer';
4
4
  import { type PixelmatchOptions } from 'pixelmatch';
5
- import type { AriaRole } from '@a11y-tools/aria-roles';
5
+ import { type AriaRole } from '@a11y-tools/aria-roles';
6
6
  export type AriaRoleExtended = AriaRole | 'element' | 'input';
7
7
  import { Buffer } from 'buffer';
8
+ export declare function isAriaRoleExtended(role: string): role is AriaRoleExtended;
8
9
  interface Common {
9
10
  info: {
10
11
  feature: string;
@@ -30,9 +31,7 @@ export interface QuickPickleWorldInterface {
30
31
  isComplete: boolean;
31
32
  config: QuickPickleConfig;
32
33
  worldConfig: QuickPickleConfig['worldConfig'];
33
- data: {
34
- [key: string]: any;
35
- };
34
+ data: Record<string, any>;
36
35
  common: Common;
37
36
  init: () => Promise<void>;
38
37
  tagsMatch(tags: string[]): string[] | null;
@@ -48,7 +47,7 @@ export declare class QuickPickleWorld implements QuickPickleWorldInterface {
48
47
  info: QuickPickleWorldInterface['info'];
49
48
  common: QuickPickleWorldInterface['common'];
50
49
  context: TestContext;
51
- data: {};
50
+ data: Record<string, any>;
52
51
  sanitizePath: typeof sanitize;
53
52
  constructor(context: TestContext, info: InfoConstructor);
54
53
  init(): Promise<void>;
@@ -101,8 +100,35 @@ export type VisualDiffResult = {
101
100
  pct: number;
102
101
  };
103
102
  export type ScreenshotComparisonOptions = any & Partial<PixelmatchOptions> & {
103
+ /**
104
+ * The maximum difference between the actual and expected images, as a percentage of the total number of pixels.
105
+ */
104
106
  maxDiffPercentage?: number;
107
+ /**
108
+ * The maximum difference between the actual and expected images, as the number of pixels.
109
+ */
105
110
  maxDiffPixels?: number;
111
+ /**
112
+ * Whether to compare the images even if they are of different sizes by resizing them as necessary.
113
+ * @default false
114
+ */
115
+ resizeEnabled?: boolean;
116
+ /**
117
+ * Whether to ignore the resized area when comparing images.
118
+ */
119
+ resizeIgnored?: boolean;
120
+ /**
121
+ * The color to use for resizing images, in [r,g,b] format, with values from 0 to 255.
122
+ * If this number is too similar to the color of the larger image, the resized area
123
+ * will be ignored by the pixelmatch algorithm.
124
+ * @default [255,0,128]
125
+ */
126
+ resizeColor?: [number, number, number];
127
+ /**
128
+ * The anchor point to use if the images are of different size.
129
+ * @default "top left"
130
+ */
131
+ resizeAnchor?: 'top left' | 'top right' | 'bottom left' | 'bottom right' | 'center' | 'top' | 'bottom' | 'left' | 'right';
106
132
  };
107
133
  export declare const defaultScreenshotComparisonOptions: ScreenshotComparisonOptions;
108
134
  export interface VisualConfigSetting {
@@ -163,7 +189,7 @@ export interface VisualWorldInterface extends StubVisualWorldInterface {
163
189
  * @param text string
164
190
  * A string that the element must contain.
165
191
  */
166
- getLocator(locator: any, identifier: string, role: AriaRoleExtended, text?: string | null): any;
192
+ getLocator(locator: any, identifier: string, role: AriaRoleExtended | string, text?: string | null): any;
167
193
  /**
168
194
  * Sets a value on a form element based on its type (select, checkbox/radio, or other input).
169
195
  * The "Locator" interface used should be whatever is compatible with the testing library
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quickpickle",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Plugin for Vitest to run tests written in Gherkin Syntax.",
5
5
  "keywords": [
6
6
  "BDD",
@@ -41,6 +41,8 @@
41
41
  "@cucumber/messages": "^27.2.0",
42
42
  "@cucumber/tag-expressions": "^6.1.2",
43
43
  "buffer": "^6.0.3",
44
+ "image-crop-or-pad": "^1.0.1",
45
+ "js-yaml": "^4.1.1",
44
46
  "lodash": "^4.17.21",
45
47
  "lodash-es": "^4.17.21",
46
48
  "pngjs": "^7.0.0"
@@ -51,6 +53,7 @@
51
53
  "@rollup/plugin-replace": "^6.0.2",
52
54
  "@rollup/plugin-terser": "^0.4.4",
53
55
  "@rollup/plugin-typescript": "^12.1.2",
56
+ "@types/js-yaml": "^4.0.9",
54
57
  "@types/lodash": "^4.17.16",
55
58
  "@types/lodash-es": "^4.17.12",
56
59
  "@types/node": "^22.15.17",
@@ -65,7 +68,7 @@
65
68
  },
66
69
  "repository": {
67
70
  "type": "git",
68
- "url": "https://github.com/dnotes/quickpickle.git"
71
+ "url": "https://github.com/dnotes/quickpickle"
69
72
  },
70
73
  "scripts": {
71
74
  "build": "rollup -c && FORMAT=cjs rollup -c",