@vitest/browser 4.1.2 → 4.1.3

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.
@@ -1,160 +1,102 @@
1
1
  import { UserEventClickOptions, UserEventWheelOptions, UserEventClearOptions, UserEventHoverOptions, UserEventFillOptions, UserEventUploadOptions, UserEventDragAndDropOptions, UserEventSelectOptions, LocatorScreenshotOptions, MarkOptions, LocatorByRoleOptions, LocatorOptions, SelectorOptions } from 'vitest/browser';
2
2
 
3
+ //#region src/cssParser.d.ts
3
4
  type ClauseCombinator = '' | '>' | '+' | '~' | '>=';
4
5
  type CSSFunctionArgument = CSSComplexSelector | number | string;
5
6
  interface CSSFunction {
6
- name: string;
7
- args: CSSFunctionArgument[];
7
+ name: string;
8
+ args: CSSFunctionArgument[];
8
9
  }
9
10
  interface CSSSimpleSelector {
10
- css?: string;
11
- functions: CSSFunction[];
11
+ css?: string;
12
+ functions: CSSFunction[];
12
13
  }
13
14
  interface CSSComplexSelector {
14
- simples: {
15
- selector: CSSSimpleSelector;
16
- combinator: ClauseCombinator;
17
- }[];
15
+ simples: {
16
+ selector: CSSSimpleSelector;
17
+ combinator: ClauseCombinator;
18
+ }[];
18
19
  }
19
20
  type CSSComplexSelectorList = CSSComplexSelector[];
20
-
21
- /**
22
- * Copyright (c) Microsoft Corporation.
23
- *
24
- * Licensed under the Apache License, Version 2.0 (the "License");
25
- * you may not use this file except in compliance with the License.
26
- * You may obtain a copy of the License at
27
- *
28
- * http://www.apache.org/licenses/LICENSE-2.0
29
- *
30
- * Unless required by applicable law or agreed to in writing, software
31
- * distributed under the License is distributed on an "AS IS" BASIS,
32
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
- * See the License for the specific language governing permissions and
34
- * limitations under the License.
35
- */
36
-
21
+ //#endregion
22
+ //#region src/selectorParser.d.ts
37
23
  interface NestedSelectorBody {
38
- parsed: ParsedSelector;
39
- distance?: number;
24
+ parsed: ParsedSelector;
25
+ distance?: number;
40
26
  }
41
27
  interface ParsedSelectorPart {
42
- name: string;
43
- body: string | CSSComplexSelectorList | NestedSelectorBody;
44
- source: string;
28
+ name: string;
29
+ body: string | CSSComplexSelectorList | NestedSelectorBody;
30
+ source: string;
45
31
  }
46
32
  interface ParsedSelector {
47
- parts: ParsedSelectorPart[];
48
- capture?: number;
33
+ parts: ParsedSelectorPart[];
34
+ capture?: number;
49
35
  }
50
-
51
- /**
52
- * Copyright (c) Microsoft Corporation.
53
- *
54
- * Licensed under the Apache License, Version 2.0 (the "License");
55
- * you may not use this file except in compliance with the License.
56
- * You may obtain a copy of the License at
57
- *
58
- * http://www.apache.org/licenses/LICENSE-2.0
59
- *
60
- * Unless required by applicable law or agreed to in writing, software
61
- * distributed under the License is distributed on an "AS IS" BASIS,
62
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
63
- * See the License for the specific language governing permissions and
64
- * limitations under the License.
65
- */
66
-
36
+ //#endregion
37
+ //#region src/selectorGenerator.d.ts
67
38
  interface GenerateSelectorOptions {
68
- testIdAttributeName: string;
39
+ testIdAttributeName: string;
69
40
  }
70
-
71
- /**
72
- * Copyright (c) Microsoft Corporation.
73
- *
74
- * Licensed under the Apache License, Version 2.0 (the "License");
75
- * you may not use this file except in compliance with the License.
76
- * You may obtain a copy of the License at
77
- *
78
- * http://www.apache.org/licenses/LICENSE-2.0
79
- *
80
- * Unless required by applicable law or agreed to in writing, software
81
- * distributed under the License is distributed on an "AS IS" BASIS,
82
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
83
- * See the License for the specific language governing permissions and
84
- * limitations under the License.
85
- */
86
-
41
+ //#endregion
42
+ //#region src/selectorUtils.d.ts
87
43
  interface ElementText {
88
- full: string;
89
- normalized: string;
90
- immediate: string[];
44
+ full: string;
45
+ normalized: string;
46
+ immediate: string[];
91
47
  }
92
-
93
- /**
94
- * Copyright (c) Microsoft Corporation.
95
- *
96
- * Licensed under the Apache License, Version 2.0 (the "License");
97
- * you may not use this file except in compliance with the License.
98
- * You may obtain a copy of the License at
99
- *
100
- * http://www.apache.org/licenses/LICENSE-2.0
101
- *
102
- * Unless required by applicable law or agreed to in writing, software
103
- * distributed under the License is distributed on an "AS IS" BASIS,
104
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
105
- * See the License for the specific language governing permissions and
106
- * limitations under the License.
107
- */
108
-
48
+ //#endregion
49
+ //#region src/selectorEvaluator.d.ts
109
50
  interface QueryContext {
110
- scope: Element | Document;
111
- pierceShadow: boolean;
112
- originalScope?: Element | Document;
51
+ scope: Element | Document;
52
+ pierceShadow: boolean;
53
+ originalScope?: Element | Document;
113
54
  }
114
55
  type Selector = any;
115
56
  interface SelectorEvaluator {
116
- query: (context: QueryContext, selector: Selector) => Element[];
117
- matches: (element: Element, selector: Selector, context: QueryContext) => boolean;
57
+ query: (context: QueryContext, selector: Selector) => Element[];
58
+ matches: (element: Element, selector: Selector, context: QueryContext) => boolean;
118
59
  }
119
60
  interface SelectorEngine$1 {
120
- matches?: (element: Element, args: (string | number | Selector)[], context: QueryContext, evaluator: SelectorEvaluator) => boolean;
121
- query?: (context: QueryContext, args: (string | number | Selector)[], evaluator: SelectorEvaluator) => Element[];
61
+ matches?: (element: Element, args: (string | number | Selector)[], context: QueryContext, evaluator: SelectorEvaluator) => boolean;
62
+ query?: (context: QueryContext, args: (string | number | Selector)[], evaluator: SelectorEvaluator) => Element[];
122
63
  }
123
64
  declare class SelectorEvaluatorImpl implements SelectorEvaluator {
124
- private _engines;
125
- private _cacheQueryCSS;
126
- private _cacheMatches;
127
- private _cacheQuery;
128
- private _cacheMatchesSimple;
129
- private _cacheMatchesParents;
130
- private _cacheCallMatches;
131
- private _cacheCallQuery;
132
- private _cacheQuerySimple;
133
- _cacheText: Map<Element | ShadowRoot, ElementText>;
134
- private _scoreMap;
135
- private _retainCacheCounter;
136
- constructor(extraEngines: Map<string, SelectorEngine$1>);
137
- begin(): void;
138
- end(): void;
139
- private _cached;
140
- private _checkSelector;
141
- matches(element: Element, s: Selector, context: QueryContext): boolean;
142
- query(context: QueryContext, s: any): Element[];
143
- _markScore(element: Element, score: number): void;
144
- private _hasScopeClause;
145
- private _expandContextForScopeMatching;
146
- private _matchesSimple;
147
- private _querySimple;
148
- private _matchesParents;
149
- private _matchesEngine;
150
- private _queryEngine;
151
- private _callMatches;
152
- private _callQuery;
153
- private _matchesCSS;
154
- _queryCSS(context: QueryContext, css: string): Element[];
155
- private _getEngine;
65
+ private _engines;
66
+ private _cacheQueryCSS;
67
+ private _cacheMatches;
68
+ private _cacheQuery;
69
+ private _cacheMatchesSimple;
70
+ private _cacheMatchesParents;
71
+ private _cacheCallMatches;
72
+ private _cacheCallQuery;
73
+ private _cacheQuerySimple;
74
+ _cacheText: Map<Element | ShadowRoot, ElementText>;
75
+ private _scoreMap;
76
+ private _retainCacheCounter;
77
+ constructor(extraEngines: Map<string, SelectorEngine$1>);
78
+ begin(): void;
79
+ end(): void;
80
+ private _cached;
81
+ private _checkSelector;
82
+ matches(element: Element, s: Selector, context: QueryContext): boolean;
83
+ query(context: QueryContext, s: any): Element[];
84
+ _markScore(element: Element, score: number): void;
85
+ private _hasScopeClause;
86
+ private _expandContextForScopeMatching;
87
+ private _matchesSimple;
88
+ private _querySimple;
89
+ private _matchesParents;
90
+ private _matchesEngine;
91
+ private _queryEngine;
92
+ private _callMatches;
93
+ private _callQuery;
94
+ private _matchesCSS;
95
+ _queryCSS(context: QueryContext, css: string): Element[];
96
+ private _getEngine;
156
97
  }
157
-
98
+ //#endregion
99
+ //#region src/locatorUtils.d.ts
158
100
  /**
159
101
  * Copyright (c) Microsoft Corporation.
160
102
  *
@@ -171,129 +113,116 @@ declare class SelectorEvaluatorImpl implements SelectorEvaluator {
171
113
  * limitations under the License.
172
114
  */
173
115
  interface ByRoleOptions {
174
- checked?: boolean;
175
- disabled?: boolean;
176
- exact?: boolean;
177
- expanded?: boolean;
178
- includeHidden?: boolean;
179
- level?: number;
180
- name?: string | RegExp;
181
- pressed?: boolean;
182
- selected?: boolean;
116
+ checked?: boolean;
117
+ disabled?: boolean;
118
+ exact?: boolean;
119
+ expanded?: boolean;
120
+ includeHidden?: boolean;
121
+ level?: number;
122
+ name?: string | RegExp;
123
+ pressed?: boolean;
124
+ selected?: boolean;
183
125
  }
184
126
  declare function getByTestIdSelector(testIdAttributeName: string, testId: string | RegExp): string;
185
127
  declare function getByLabelSelector(text: string | RegExp, options?: {
186
- exact?: boolean;
128
+ exact?: boolean;
187
129
  }): string;
188
130
  declare function getByAltTextSelector(text: string | RegExp, options?: {
189
- exact?: boolean;
131
+ exact?: boolean;
190
132
  }): string;
191
133
  declare function getByTitleSelector(text: string | RegExp, options?: {
192
- exact?: boolean;
134
+ exact?: boolean;
193
135
  }): string;
194
136
  declare function getByPlaceholderSelector(text: string | RegExp, options?: {
195
- exact?: boolean;
137
+ exact?: boolean;
196
138
  }): string;
197
139
  declare function getByTextSelector(text: string | RegExp, options?: {
198
- exact?: boolean;
140
+ exact?: boolean;
199
141
  }): string;
200
142
  declare function getByRoleSelector(role: string, options?: ByRoleOptions): string;
201
-
202
- /**
203
- * Copyright (c) Microsoft Corporation.
204
- *
205
- * Licensed under the Apache License, Version 2.0 (the "License");
206
- * you may not use this file except in compliance with the License.
207
- * You may obtain a copy of the License at
208
- *
209
- * http://www.apache.org/licenses/LICENSE-2.0
210
- *
211
- * Unless required by applicable law or agreed to in writing, software
212
- * distributed under the License is distributed on an "AS IS" BASIS,
213
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
214
- * See the License for the specific language governing permissions and
215
- * limitations under the License.
216
- */
217
-
143
+ //#endregion
144
+ //#region src/ivya.d.ts
218
145
  interface IvyaOptions {
219
- testIdAttribute: string;
220
- browser: 'webkit' | 'chromium' | 'firefox';
146
+ testIdAttribute: string;
147
+ browser: 'webkit' | 'chromium' | 'firefox';
148
+ exact: boolean;
221
149
  }
222
150
  interface IvyaConfiguration {
223
- testIdAttribute?: string;
224
- browser: 'webkit' | 'chromium' | 'firefox';
151
+ testIdAttribute?: string;
152
+ exact?: boolean;
153
+ browser: 'webkit' | 'chromium' | 'firefox';
225
154
  }
226
155
  declare class Ivya {
227
- /** @internal */
228
- _engines: Map<string, SelectorEngine>;
229
- /** @internal */
230
- _evaluator: SelectorEvaluatorImpl;
231
- static options: IvyaOptions;
232
- private static singleton;
233
- static create(options: IvyaConfiguration): Ivya;
234
- private constructor();
235
- queryLocatorSelector(locator: string, root?: Node, strict?: boolean): Element | null;
236
- queryLocatorSelectorAll(locator: string, root?: Node): Element[];
237
- querySelector(selector: ParsedSelector, root: Node, strict?: boolean): Element | null;
238
- queryAllByRole(text: string, options?: ByRoleOptions, container?: Node): Element[];
239
- queryAllByLabelText(text: string | RegExp, options?: {
240
- exact?: boolean;
241
- }, container?: Node): Element[];
242
- queryAllByTestId(text: string | RegExp, container?: Node): Element[];
243
- queryAllByText(text: string | RegExp, options?: {
244
- exact?: boolean;
245
- }, container?: Node): Element[];
246
- queryAllByTitle(text: string | RegExp, options?: {
247
- exact?: boolean;
248
- }, container?: Node): Element[];
249
- queryAllByPlaceholder(text: string | RegExp, options?: {
250
- exact?: boolean;
251
- }, container?: Node): Element[];
252
- queryAllByAltText(text: string | RegExp, options?: {
253
- exact?: boolean;
254
- }, container?: Node): Element[];
255
- queryByRole(text: string, options?: ByRoleOptions, container?: Node): Element | null;
256
- queryByLabelText(text: string | RegExp, options?: {
257
- exact?: boolean;
258
- }, container?: Node): Element | null;
259
- queryByTestId(text: string | RegExp, container?: Node): Element | null;
260
- queryByText(text: string | RegExp, options?: {
261
- exact?: boolean;
262
- }, container?: Node): Element | null;
263
- queryByTitle(text: string | RegExp, options?: {
264
- exact?: boolean;
265
- }, container?: Node): Element | null;
266
- queryByPlaceholder(text: string | RegExp, options?: {
267
- exact?: boolean;
268
- }, container?: Node): Element | null;
269
- queryByAltText(text: string | RegExp, options?: {
270
- exact?: boolean;
271
- }, container?: Node): Element | null;
272
- private strictModeViolationError;
273
- generateSelectorSimple(targetElement: Element, options?: GenerateSelectorOptions): string;
274
- parseSelector(selector: string): ParsedSelector;
275
- previewNode(node: Node): string;
276
- querySelectorAll(selector: ParsedSelector, root: Node): Element[];
277
- private _queryEngineAll;
278
- private _queryNth;
279
- private _queryLayoutSelector;
280
- private createStacklessError;
281
- private _createTextEngine;
282
- private _createAttributeEngine;
283
- private _createCSSEngine;
284
- private _createNamedAttributeEngine;
285
- private _createVisibleEngine;
286
- private _createControlEngine;
287
- private _createHasEngine;
288
- private _createHasNotEngine;
289
- private _createInternalChainEngine;
290
- private _createInternalLabelEngine;
291
- private _createInternalHasTextEngine;
292
- private _createInternalHasNotTextEngine;
156
+ /** @internal */
157
+ _engines: Map<string, SelectorEngine>;
158
+ /** @internal */
159
+ _evaluator: SelectorEvaluatorImpl;
160
+ static options: IvyaOptions;
161
+ private static singleton;
162
+ static create(options: IvyaConfiguration): Ivya;
163
+ private constructor();
164
+ queryLocatorSelector(locator: string, root?: Node, strict?: boolean): Element | null;
165
+ queryLocatorSelectorAll(locator: string, root?: Node): Element[];
166
+ querySelector(selector: ParsedSelector, root: Node, strict?: boolean): Element | null;
167
+ queryAllByRole(text: string, options?: ByRoleOptions, container?: Node): Element[];
168
+ queryAllByLabelText(text: string | RegExp, options?: {
169
+ exact?: boolean;
170
+ }, container?: Node): Element[];
171
+ queryAllByTestId(text: string | RegExp, container?: Node): Element[];
172
+ queryAllByText(text: string | RegExp, options?: {
173
+ exact?: boolean;
174
+ }, container?: Node): Element[];
175
+ queryAllByTitle(text: string | RegExp, options?: {
176
+ exact?: boolean;
177
+ }, container?: Node): Element[];
178
+ queryAllByPlaceholder(text: string | RegExp, options?: {
179
+ exact?: boolean;
180
+ }, container?: Node): Element[];
181
+ queryAllByAltText(text: string | RegExp, options?: {
182
+ exact?: boolean;
183
+ }, container?: Node): Element[];
184
+ queryByRole(text: string, options?: ByRoleOptions, container?: Node): Element | null;
185
+ queryByLabelText(text: string | RegExp, options?: {
186
+ exact?: boolean;
187
+ }, container?: Node): Element | null;
188
+ queryByTestId(text: string | RegExp, container?: Node): Element | null;
189
+ queryByText(text: string | RegExp, options?: {
190
+ exact?: boolean;
191
+ }, container?: Node): Element | null;
192
+ queryByTitle(text: string | RegExp, options?: {
193
+ exact?: boolean;
194
+ }, container?: Node): Element | null;
195
+ queryByPlaceholder(text: string | RegExp, options?: {
196
+ exact?: boolean;
197
+ }, container?: Node): Element | null;
198
+ queryByAltText(text: string | RegExp, options?: {
199
+ exact?: boolean;
200
+ }, container?: Node): Element | null;
201
+ private strictModeViolationError;
202
+ generateSelectorSimple(targetElement: Element, options?: GenerateSelectorOptions): string;
203
+ parseSelector(selector: string): ParsedSelector;
204
+ previewNode(node: Node): string;
205
+ querySelectorAll(selector: ParsedSelector, root: Node): Element[];
206
+ private _queryEngineAll;
207
+ private _queryNth;
208
+ private _queryLayoutSelector;
209
+ private createStacklessError;
210
+ private _createTextEngine;
211
+ private _createAttributeEngine;
212
+ private _createCSSEngine;
213
+ private _createNamedAttributeEngine;
214
+ private _createVisibleEngine;
215
+ private _createControlEngine;
216
+ private _createHasEngine;
217
+ private _createHasNotEngine;
218
+ private _createInternalChainEngine;
219
+ private _createInternalLabelEngine;
220
+ private _createInternalHasTextEngine;
221
+ private _createInternalHasNotTextEngine;
293
222
  }
294
223
  type SelectorRoot = Element | ShadowRoot | Document;
295
224
  interface SelectorEngine {
296
- queryAll: (root: SelectorRoot, selector: string | any) => Element[];
225
+ queryAll: (root: SelectorRoot, selector: string | any) => Element[];
297
226
  }
298
227
 
299
228
  declare function convertElementToCssSelector(element: Element): string;
package/dist/locators.js CHANGED
@@ -1 +1 @@
1
- export{L as Locator,o as convertElementToCssSelector,q as ensureAwaited,r as getByAltTextSelector,s as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,y as getIframeScale,p as processTimeoutOptions,z as selectorEngine,A as triggerCommandWithTrace}from"./index-5Pe7X7sp.js";import"vitest/browser";import"vitest/internal/browser";
1
+ export{L as Locator,o as convertElementToCssSelector,q as ensureAwaited,r as getByAltTextSelector,s as getByLabelSelector,t as getByPlaceholderSelector,u as getByRoleSelector,v as getByTestIdSelector,w as getByTextSelector,x as getByTitleSelector,y as getIframeScale,p as processTimeoutOptions,z as selectorEngine,A as triggerCommandWithTrace}from"./index-C8KwPhQz.js";import"vitest/browser";import"vitest/internal/browser";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@vitest/browser",
3
3
  "type": "module",
4
- "version": "4.1.2",
4
+ "version": "4.1.3",
5
5
  "description": "Browser running for Vitest",
6
6
  "license": "MIT",
7
7
  "funding": "https://opencollective.com/vitest",
@@ -57,7 +57,7 @@
57
57
  "providers"
58
58
  ],
59
59
  "peerDependencies": {
60
- "vitest": "4.1.2"
60
+ "vitest": "4.1.3"
61
61
  },
62
62
  "dependencies": {
63
63
  "@blazediff/core": "1.9.1",
@@ -66,8 +66,8 @@
66
66
  "sirv": "^3.0.2",
67
67
  "tinyrainbow": "^3.1.0",
68
68
  "ws": "^8.19.0",
69
- "@vitest/mocker": "4.1.2",
70
- "@vitest/utils": "4.1.2"
69
+ "@vitest/mocker": "4.1.3",
70
+ "@vitest/utils": "4.1.3"
71
71
  },
72
72
  "devDependencies": {
73
73
  "@opentelemetry/api": "^1.9.0",
@@ -76,11 +76,11 @@
76
76
  "@types/ws": "^8.18.1",
77
77
  "birpc": "^4.0.0",
78
78
  "flatted": "^3.4.2",
79
- "ivya": "^1.7.1",
79
+ "ivya": "^1.8.0",
80
80
  "mime": "^4.1.0",
81
81
  "pathe": "^2.0.3",
82
- "@vitest/runner": "4.1.2",
83
- "vitest": "4.1.2"
82
+ "vitest": "4.1.3",
83
+ "@vitest/runner": "4.1.3"
84
84
  },
85
85
  "scripts": {
86
86
  "typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",