@vitest/browser 5.0.2 → 5.0.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.
- package/aria-role.d.ts +84 -84
- package/context.d.ts +27 -11
- package/context.js +5 -5
- package/dist/client/.vite/manifest.json +1 -1
- package/dist/client/__vitest_browser__/{tester-COH68OX9.js → tester-C2LTsndn.js} +10 -3
- package/dist/client/error-catcher.js +16 -16
- package/dist/client/orchestrator.html +3 -5
- package/dist/client/tester/tester.html +3 -3
- package/dist/context.js +3 -3
- package/dist/expect-element.js +25 -25
- package/dist/index.js +13 -272
- package/jest-dom.d.ts +37 -21
- package/matchers.d.ts +5 -5
- package/package.json +7 -7
- package/utils.d.ts +1 -1
package/aria-role.d.ts
CHANGED
|
@@ -1,96 +1,96 @@
|
|
|
1
1
|
type ARIAWidgetRole =
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
2
|
+
| 'button'
|
|
3
|
+
| 'checkbox'
|
|
4
|
+
| 'gridcell'
|
|
5
|
+
| 'link'
|
|
6
|
+
| 'menuitem'
|
|
7
|
+
| 'menuitemcheckbox'
|
|
8
|
+
| 'menuitemradio'
|
|
9
|
+
| 'option'
|
|
10
|
+
| 'progressbar'
|
|
11
|
+
| 'radio'
|
|
12
|
+
| 'scrollbar'
|
|
13
|
+
| 'searchbox'
|
|
14
|
+
| 'slider'
|
|
15
|
+
| 'spinbutton'
|
|
16
|
+
| 'switch'
|
|
17
|
+
| 'tab'
|
|
18
|
+
| 'tabpanel'
|
|
19
|
+
| 'textbox'
|
|
20
|
+
| 'treeitem'
|
|
21
21
|
|
|
22
22
|
type ARIACompositeWidgetRole =
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
23
|
+
| 'combobox'
|
|
24
|
+
| 'grid'
|
|
25
|
+
| 'listbox'
|
|
26
|
+
| 'menu'
|
|
27
|
+
| 'menubar'
|
|
28
|
+
| 'radiogroup'
|
|
29
|
+
| 'tablist'
|
|
30
|
+
| 'tree'
|
|
31
|
+
| 'treegrid'
|
|
32
32
|
|
|
33
33
|
type ARIADocumentStructureRole =
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
34
|
+
| 'application'
|
|
35
|
+
| 'article'
|
|
36
|
+
| 'blockquote'
|
|
37
|
+
| 'caption'
|
|
38
|
+
| 'cell'
|
|
39
|
+
| 'columnheader'
|
|
40
|
+
| 'definition'
|
|
41
|
+
| 'deletion'
|
|
42
|
+
| 'directory'
|
|
43
|
+
| 'document'
|
|
44
|
+
| 'emphasis'
|
|
45
|
+
| 'feed'
|
|
46
|
+
| 'figure'
|
|
47
|
+
| 'generic'
|
|
48
|
+
| 'group'
|
|
49
|
+
| 'heading'
|
|
50
|
+
| 'img'
|
|
51
|
+
| 'insertion'
|
|
52
|
+
| 'list'
|
|
53
|
+
| 'listitem'
|
|
54
|
+
| 'math'
|
|
55
|
+
| 'meter'
|
|
56
|
+
| 'none'
|
|
57
|
+
| 'note'
|
|
58
|
+
| 'paragraph'
|
|
59
|
+
| 'presentation'
|
|
60
|
+
| 'row'
|
|
61
|
+
| 'rowgroup'
|
|
62
|
+
| 'rowheader'
|
|
63
|
+
| 'separator'
|
|
64
|
+
| 'strong'
|
|
65
|
+
| 'subscript'
|
|
66
|
+
| 'superscript'
|
|
67
|
+
| 'table'
|
|
68
|
+
| 'term'
|
|
69
|
+
| 'time'
|
|
70
|
+
| 'toolbar'
|
|
71
|
+
| 'tooltip'
|
|
72
72
|
|
|
73
73
|
type ARIALandmarkRole =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
| 'banner'
|
|
75
|
+
| 'complementary'
|
|
76
|
+
| 'contentinfo'
|
|
77
|
+
| 'form'
|
|
78
|
+
| 'main'
|
|
79
|
+
| 'navigation'
|
|
80
|
+
| 'region'
|
|
81
|
+
| 'search'
|
|
82
82
|
|
|
83
|
-
type ARIALiveRegionRole =
|
|
83
|
+
type ARIALiveRegionRole = 'alert' | 'log' | 'marquee' | 'status' | 'timer'
|
|
84
84
|
|
|
85
|
-
type ARIAWindowRole =
|
|
85
|
+
type ARIAWindowRole = 'alertdialog' | 'dialog'
|
|
86
86
|
|
|
87
|
-
type ARIAUncategorizedRole =
|
|
87
|
+
type ARIAUncategorizedRole = 'code'
|
|
88
88
|
|
|
89
89
|
export type ARIARole =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
| ARIAWidgetRole
|
|
91
|
+
| ARIACompositeWidgetRole
|
|
92
|
+
| ARIADocumentStructureRole
|
|
93
|
+
| ARIALandmarkRole
|
|
94
|
+
| ARIALiveRegionRole
|
|
95
|
+
| ARIAWindowRole
|
|
96
|
+
| ARIAUncategorizedRole
|
package/context.d.ts
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
import { __ivyaAriaTypes } from '@vitest/browser/internal/vendor-types'
|
|
1
2
|
import { SerializedConfig } from 'vitest'
|
|
2
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
StringifyOptions,
|
|
5
|
+
CDPSession,
|
|
6
|
+
BrowserCommands,
|
|
7
|
+
BrowserTraceEntryKind,
|
|
8
|
+
MarkOptions,
|
|
9
|
+
} from 'vitest/internal/browser'
|
|
3
10
|
import { ARIARole } from './aria-role.js'
|
|
4
11
|
import {} from './matchers.js'
|
|
5
|
-
import { __ivyaAriaTypes } from '@vitest/browser/internal/vendor-types'
|
|
6
12
|
|
|
7
13
|
export type BufferEncoding =
|
|
8
14
|
| 'ascii'
|
|
@@ -18,7 +24,7 @@ export type BufferEncoding =
|
|
|
18
24
|
| 'binary'
|
|
19
25
|
| 'hex'
|
|
20
26
|
|
|
21
|
-
export { BrowserTraceEntryKind, CDPSession, MarkOptions }
|
|
27
|
+
export { BrowserTraceEntryKind, CDPSession, MarkOptions }
|
|
22
28
|
|
|
23
29
|
export interface ScreenshotOptions extends SelectorOptions {
|
|
24
30
|
/**
|
|
@@ -146,7 +152,7 @@ export type NonStandardScreenshotComparators = Omit<
|
|
|
146
152
|
>
|
|
147
153
|
|
|
148
154
|
export interface ScreenshotMatcherOptions<
|
|
149
|
-
ComparatorName extends keyof ScreenshotComparatorRegistry = keyof ScreenshotComparatorRegistry
|
|
155
|
+
ComparatorName extends keyof ScreenshotComparatorRegistry = keyof ScreenshotComparatorRegistry,
|
|
150
156
|
> {
|
|
151
157
|
/**
|
|
152
158
|
* The name of the comparator to use for visual diffing.
|
|
@@ -320,7 +326,11 @@ export interface UserEvent {
|
|
|
320
326
|
* @see {@link https://playwright.dev/docs/api/class-locator#locator-set-input-files} Playwright API
|
|
321
327
|
* @see {@link https://testing-library.com/docs/user-event/utility#upload} testing-library API
|
|
322
328
|
*/
|
|
323
|
-
upload: (
|
|
329
|
+
upload: (
|
|
330
|
+
element: Element | Locator,
|
|
331
|
+
files: File | File[] | string | string[],
|
|
332
|
+
options?: UserEventUploadOptions,
|
|
333
|
+
) => Promise<void>
|
|
324
334
|
/**
|
|
325
335
|
* Copies the selected content.
|
|
326
336
|
* @see {@link https://playwright.dev/docs/api/class-keyboard} Playwright API
|
|
@@ -360,7 +370,11 @@ export interface UserEvent {
|
|
|
360
370
|
* @see {@link https://playwright.dev/docs/api/class-frame#frame-drag-and-drop} Playwright API
|
|
361
371
|
* @see {@link https://webdriver.io/docs/api/element/dragAndDrop/} WebdriverIO API
|
|
362
372
|
*/
|
|
363
|
-
dragAndDrop: (
|
|
373
|
+
dragAndDrop: (
|
|
374
|
+
source: Element | Locator,
|
|
375
|
+
target: Element | Locator,
|
|
376
|
+
options?: UserEventDragAndDropOptions,
|
|
377
|
+
) => Promise<void>
|
|
364
378
|
}
|
|
365
379
|
|
|
366
380
|
export interface UserEventFillOptions {}
|
|
@@ -851,10 +865,13 @@ export interface BrowserPage extends LocatorSelectors {
|
|
|
851
865
|
base64: string
|
|
852
866
|
}>
|
|
853
867
|
screenshot(options?: Omit<ScreenshotOptions, 'base64'>): Promise<string>
|
|
854
|
-
screenshot(options?: ScreenshotOptions): Promise<
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
868
|
+
screenshot(options?: ScreenshotOptions): Promise<
|
|
869
|
+
| string
|
|
870
|
+
| {
|
|
871
|
+
path: string
|
|
872
|
+
base64: string
|
|
873
|
+
}
|
|
874
|
+
>
|
|
858
875
|
/**
|
|
859
876
|
* Add a trace marker when browser tracing is enabled.
|
|
860
877
|
* @see {@link https://vitest.dev/api/browser/context#mark}
|
|
@@ -927,7 +944,6 @@ export interface BrowserLocators {
|
|
|
927
944
|
}): void
|
|
928
945
|
}
|
|
929
946
|
|
|
930
|
-
|
|
931
947
|
export type PrettyDOMOptions = Omit<StringifyOptions, 'maxLength'>
|
|
932
948
|
|
|
933
949
|
export const utils: {
|
package/context.js
CHANGED
|
@@ -12,9 +12,9 @@ export const utils = null
|
|
|
12
12
|
const pool = globalThis.__vitest_worker__?.ctx?.pool
|
|
13
13
|
|
|
14
14
|
throw new Error(
|
|
15
|
-
//
|
|
16
|
-
'vitest/browser can be imported only inside the Browser Mode. '
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
15
|
+
// oxlint-disable-next-line prefer-template
|
|
16
|
+
'vitest/browser can be imported only inside the Browser Mode. ' +
|
|
17
|
+
(pool
|
|
18
|
+
? `Your test is running in ${pool} pool. Make sure your regular tests are excluded from the "test.include" glob pattern.`
|
|
19
|
+
: 'Instead, it was imported outside of Vitest.'),
|
|
20
20
|
)
|
|
@@ -1206,6 +1206,13 @@ function sendLog(type, content, disableStack) {
|
|
|
1206
1206
|
});
|
|
1207
1207
|
}
|
|
1208
1208
|
|
|
1209
|
+
//#endregion
|
|
1210
|
+
//#region ../mocker/dist/chunk-helpers.js
|
|
1211
|
+
function withTrailingSlash(path) {
|
|
1212
|
+
if (path.at(-1) !== "/") return `${path}/`;
|
|
1213
|
+
return path;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1209
1216
|
//#endregion
|
|
1210
1217
|
//#region ../mocker/dist/chunk-registry.js
|
|
1211
1218
|
var MockerRegistry = class {
|
|
@@ -1685,7 +1692,7 @@ var ModuleMocker = class {
|
|
|
1685
1692
|
}
|
|
1686
1693
|
async prepare() {
|
|
1687
1694
|
if (!this.queue.size) return;
|
|
1688
|
-
await Promise.all(
|
|
1695
|
+
await Promise.all(this.queue.values());
|
|
1689
1696
|
}
|
|
1690
1697
|
async resolveFactoryModule(id) {
|
|
1691
1698
|
const mock = this.registry.get(id);
|
|
@@ -1822,8 +1829,8 @@ var ModuleMocker = class {
|
|
|
1822
1829
|
resolveMockPath(path) {
|
|
1823
1830
|
const config = this.config;
|
|
1824
1831
|
const fsRoot = join("/@fs/", config.root);
|
|
1825
|
-
if (path.startsWith(config.root)) return path.slice(config.root.length);
|
|
1826
|
-
if (path.startsWith(fsRoot)) return path.slice(fsRoot.length);
|
|
1832
|
+
if (path.startsWith(withTrailingSlash(config.root))) return path.slice(config.root.length);
|
|
1833
|
+
if (path.startsWith(withTrailingSlash(fsRoot))) return path.slice(fsRoot.length);
|
|
1827
1834
|
return path;
|
|
1828
1835
|
}
|
|
1829
1836
|
};
|
|
@@ -2,9 +2,8 @@ import { client } from '@vitest/browser/client'
|
|
|
2
2
|
|
|
3
3
|
function serializeError(unhandledError) {
|
|
4
4
|
const state = globalThis.__vitest_worker__
|
|
5
|
-
const VITEST_TEST_NAME =
|
|
6
|
-
? state.current.name
|
|
7
|
-
: undefined
|
|
5
|
+
const VITEST_TEST_NAME =
|
|
6
|
+
state && state.current && state.current.type === 'test' ? state.current.name : undefined
|
|
8
7
|
const VITEST_TEST_PATH = state && state.filepath ? state.filepath : undefined
|
|
9
8
|
|
|
10
9
|
if (typeof unhandledError !== 'object' || !unhandledError) {
|
|
@@ -29,8 +28,7 @@ function catchWindowErrors(errorEvent, prop, cb) {
|
|
|
29
28
|
function throwUnhandlerError(e) {
|
|
30
29
|
if (userErrorListenerCount === 0 && e[prop] != null) {
|
|
31
30
|
cb(e)
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
31
|
+
} else {
|
|
34
32
|
// `ErrorEvent` doesn't necessary have `ErrorEvent.error` defined
|
|
35
33
|
// but some has `ErrorEvent.message` defined, e.g. ResizeObserver error.
|
|
36
34
|
// https://developer.mozilla.org/en-US/docs/Web/API/ErrorEvent/error
|
|
@@ -59,24 +57,26 @@ function catchWindowErrors(errorEvent, prop, cb) {
|
|
|
59
57
|
}
|
|
60
58
|
|
|
61
59
|
function registerUnexpectedErrors() {
|
|
62
|
-
const offError = catchWindowErrors('error', 'error', event =>
|
|
63
|
-
reportUnexpectedError('Error', event.error)
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
const offError = catchWindowErrors('error', 'error', (event) =>
|
|
61
|
+
reportUnexpectedError('Error', event.error),
|
|
62
|
+
)
|
|
63
|
+
const offRejection = catchWindowErrors('unhandledrejection', 'reason', (event) =>
|
|
64
|
+
reportUnexpectedError('Unhandled Rejection', event.reason),
|
|
65
|
+
)
|
|
66
66
|
return () => {
|
|
67
67
|
offError()
|
|
68
68
|
offRejection()
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
async function reportUnexpectedError(
|
|
73
|
-
type,
|
|
74
|
-
error,
|
|
75
|
-
) {
|
|
72
|
+
async function reportUnexpectedError(type, error) {
|
|
76
73
|
const processedError = serializeError(error)
|
|
77
|
-
await client
|
|
78
|
-
|
|
79
|
-
|
|
74
|
+
await client
|
|
75
|
+
.waitForConnection()
|
|
76
|
+
.then(() => {
|
|
77
|
+
return client.rpc.onUnhandledError(processedError, type)
|
|
78
|
+
})
|
|
79
|
+
.catch(console.error)
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
globalThis.__vitest_browser_runner__.disposeExceptionTracker = registerUnexpectedErrors()
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml"
|
|
5
|
+
<link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vitest Browser Runner</title>
|
|
8
8
|
<style>
|
|
@@ -23,9 +23,7 @@
|
|
|
23
23
|
height: 100%;
|
|
24
24
|
}
|
|
25
25
|
</style>
|
|
26
|
-
{__VITEST_INJECTOR__}
|
|
27
|
-
{__VITEST_ERROR_CATCHER__}
|
|
28
|
-
{__VITEST_SCRIPTS__}
|
|
26
|
+
{__VITEST_INJECTOR__} {__VITEST_ERROR_CATCHER__} {__VITEST_SCRIPTS__}
|
|
29
27
|
<script type="module" crossorigin src="/__vitest_browser__/orchestrator-M9828UZ-.js"></script>
|
|
30
28
|
<link rel="modulepreload" crossorigin href="/__vitest_browser__/defineProperty-DgkPJYVE.js">
|
|
31
29
|
</head>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
<!
|
|
1
|
+
<!doctype html>
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml"
|
|
5
|
+
<link rel="icon" href="{__VITEST_FAVICON__}" type="image/svg+xml" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>Vitest Browser Tester</title>
|
|
8
|
-
<script type="module" crossorigin src="/__vitest_browser__/tester-
|
|
8
|
+
<script type="module" crossorigin src="/__vitest_browser__/tester-C2LTsndn.js"></script>
|
|
9
9
|
<link rel="modulepreload" crossorigin href="/__vitest_browser__/defineProperty-DgkPJYVE.js">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|
package/dist/context.js
CHANGED
|
@@ -261,7 +261,7 @@ function getUniqueCssSelector(el) {
|
|
|
261
261
|
const path = [];
|
|
262
262
|
let parent;
|
|
263
263
|
let hasShadowRoot = false;
|
|
264
|
-
//
|
|
264
|
+
// oxlint-disable-next-line no-cond-assign
|
|
265
265
|
while (parent = getParent(el)) {
|
|
266
266
|
if (parent.shadowRoot) {
|
|
267
267
|
hasShadowRoot = true;
|
|
@@ -782,10 +782,10 @@ function getElementLocatorSelectors(element) {
|
|
|
782
782
|
let defaultOptions;
|
|
783
783
|
function debug(el, maxLength, options) {
|
|
784
784
|
if (Array.isArray(el)) {
|
|
785
|
-
//
|
|
785
|
+
// oxlint-disable-next-line no-console
|
|
786
786
|
el.forEach((e) => console.log(prettyDOM(e, maxLength, options)));
|
|
787
787
|
} else {
|
|
788
|
-
//
|
|
788
|
+
// oxlint-disable-next-line no-console
|
|
789
789
|
console.log(prettyDOM(el, maxLength, options));
|
|
790
790
|
}
|
|
791
791
|
}
|
package/dist/expect-element.js
CHANGED
|
@@ -3,32 +3,32 @@ import{Snapshots as e,recordArtifact as t,expect as n,chai as r}from"vitest";imp
|
|
|
3
3
|
`);for(let e of r){let t=e.replace(/\r$/,``),r=t.replace(/^\s+/,``),i=t.length-r.length;this.lines.push({indent:i,content:r,offset:n+i,lineOffset:n,raw:t}),n+=e.length+1}for(;this.lines.length>0&&this.lines[this.lines.length-1].content===``;)this.lines.pop()}parseRoot(){if(this.lines.length===0)return null;let e=this.parseNode(0);if(this.skipEmpty(),this.pos<this.lines.length){let e=this.currentLine();this.addError(`Unexpected scalar at node end`,e.offset)}return e}currentLine(){return this.lines[this.pos]}parseNode(e){this.skipEmpty();let t=this.currentLine();return!t||t.indent<e?null:t.content.startsWith(`- `)||t.content===`-`?this.parseSequence(t.indent):this.isMapEntry(t.content)?this.parseMap(t.indent):(this.pos++,this.parseScalarValue(t.content,t.offset,t))}parseSequence(e){let t=this.currentLine(),n=new A([t.offset-t.indent,0,0]),r=t.offset;for(;this.pos<this.lines.length;){this.skipEmpty();let t=this.currentLine();if(!t||t.indent<e)break;if(t.indent>e){this.addError(`Bad indentation of a sequence entry`,t.offset);break}if(!t.content.startsWith(`- `)&&t.content!==`-`)break;let i=t.content===`-`?1:2,a=t.content.slice(i),o=t.offset+i;if(this.pos++,a===``||a.trim()===``){let t=this.parseNode(e+1);t&&(n.items.push(t),r=this.peekLastOffset())}else if(this.isMapEntry(a)){let s=this.parseInlineMap(a,o,e+i,t);n.items.push(s),r=s.range[2]}else{let e=this.parseScalarValue(a,o,t);n.items.push(e),r=e.range[2]}}return n.range[1]=r,n.range[2]=r,n}parseMap(e){let t=this.currentLine(),n=new k([t.offset-t.indent,0,0]),r=t.offset;for(;this.pos<this.lines.length;){this.skipEmpty();let t=this.currentLine();if(!t||t.indent<e)break;if(t.indent>e){this.addError(`Bad indentation of a mapping entry`,t.offset);break}if(!this.isMapEntry(t.content))break;let{key:i,valueStr:a,colonOffset:o,valueOffset:s}=this.splitMapEntry(t.content,t.offset),c=new O(i,[t.offset,t.offset+i.length,o]);this.pos++;let l;l=a===``?this.parseMapValue(e,o):this.parseScalarValue(a.trim(),s,t),n.items.push({key:c,value:l}),r=l?this.getNodeEnd(l):o+1}return n.range[1]=r,n.range[2]=r,n}parseInlineMap(e,t,n,r){let i=new k([t,0,0]),a=t,{key:o,valueStr:s,colonOffset:c,valueOffset:l}=this.splitMapEntry(e,t),u=new O(o,[t,t+o.length,c]),d;for(d=s===``?this.parseMapValue(n,c):this.parseScalarValue(s.trim(),l,r),i.items.push({key:u,value:d}),a=d?this.getNodeEnd(d):c+1;this.pos<this.lines.length;){this.skipEmpty();let e=this.currentLine();if(!e||e.indent<n||e.indent>n||!this.isMapEntry(e.content)||e.content.startsWith(`- `))break;let t=this.splitMapEntry(e.content,e.offset),r=new O(t.key,[e.offset,e.offset+t.key.length,t.colonOffset]);this.pos++;let o;o=t.valueStr===``?this.parseMapValue(n,t.colonOffset):this.parseScalarValue(t.valueStr.trim(),t.valueOffset,e),i.items.push({key:r,value:o}),a=o?this.getNodeEnd(o):t.colonOffset+1}return i.range[1]=a,i.range[2]=a,i}parseMapValue(e,t){this.skipEmpty();let n=this.currentLine();return!n||n.indent<e?new O(null,[t+1,t+1,t+1]):n.indent===e&&(n.content.startsWith(`- `)||n.content===`-`)?this.parseNode(e):n.indent>e?this.parseNode(e+1):new O(null,[t+1,t+1,t+1])}getNodeEnd(e){return e.range[2]}peekLastOffset(){if(this.pos>0&&this.pos<=this.lines.length){let e=this.lines[this.pos-1];return e.lineOffset+e.raw.length}return this.text.length}parseScalarValue(e,t,n){let r=e.trim(),i=t+e.indexOf(r),a=i+r.length,o=n.lineOffset+n.raw.length;return r.startsWith(`"`)?this.parseQuotedScalar(r,i,o):r===`true`||r===`false`?new O(r===`true`,[i,a,o]):r===`null`||r===`~`?new O(null,[i,a,o]):r!==``&&je(r)?new O(Number(r),[i,a,o]):new O(r,[i,a,o])}parseQuotedScalar(e,t,n){let r=``,i=1;for(;i<e.length;){let a=e[i];if(a===`\\`){if(i++,i>=e.length){this.addError(`Unterminated double-quoted string`,t+i);break}let n=e[i];switch(n){case`n`:r+=`
|
|
4
4
|
`;break;case`t`:r+=` `;break;case`r`:r+=`\r`;break;case`"`:r+=`"`;break;case`\\`:r+=`\\`;break;case`/`:r+=`/`;break;default:r+=n}}else if(a===`"`){let e=t+i+1;return new O(r,[t,e,n])}else r+=a;i++}return this.addError(`Unterminated double-quoted string`,t),new O(r,[t,t+e.length,n])}skipEmpty(){for(;this.pos<this.lines.length&&this.lines[this.pos].content===``;)this.pos++}isMapEntry(e){return this.findMapColon(e)>=0}findMapColon(e){let t=!1,n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){n=!1;continue}if(i===`\\`&&t){n=!0;continue}if(i===`"`){t=!t;continue}if(!t&&i===`:`&&(r+1>=e.length||e[r+1]===` `))return r}return-1}splitMapEntry(e,t){let n=this.findMapColon(e),r=e.slice(0,n).trim(),i=t+n,a=e.slice(n+1),o=a.trimStart(),s=i+1+(a.length-a.trimStart().length);return r.startsWith(`"`)&&r.endsWith(`"`)?{key:r.slice(1,-1),valueStr:o,colonOffset:i,valueOffset:s}:{key:r,valueStr:o,colonOffset:i,valueOffset:s}}addError(e,t){this.errors.push(new j(e,[t,t+1]))}};function je(e){return e===``||e===`-`||e===`+`?!1:/^[+-]?(\d+\.?\d*|\.\d+)([eE][+-]?\d+)?$/.test(e)}function M(e){return Me(e)?`"`+e.replace(/[\\"\x00-\x1f\x7f-\x9f]/g,e=>{switch(e){case`\\`:return`\\\\`;case`"`:return`\\"`;case`\b`:return`\\b`;case`\f`:return`\\f`;case`
|
|
5
5
|
`:return`\\n`;case`\r`:return`\\r`;case` `:return`\\t`;default:return`\\x`+e.charCodeAt(0).toString(16).padStart(2,`0`)}})+`"`:e}function Me(e){return!!(e.length===0||/^\s|\s$/.test(e)||/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f-\x9f]/.test(e)||/^-/.test(e)||/[\n:](\s|$)/.test(e)||/\s#/.test(e)||/[\n\r]/.test(e)||/^[&*\],?!>|@"'#%]/.test(e)||/[{}`]/.test(e)||/^\[/.test(e)||!isNaN(Number(e))||[`y`,`n`,`yes`,`no`,`true`,`false`,`on`,`off`,`null`].includes(e.toLowerCase()))}const N={visible:!0,inline:!1};function Ne(e){let t=new Set,n={role:`fragment`,name:``,children:[],props:{},box:N,receivesPointerEvents:!0},r=(n,r,o)=>{if(t.has(r))return;if(t.add(r),r.nodeType===Node.TEXT_NODE&&r.nodeValue){if(!o)return;let e=r.nodeValue;n.role!==`textbox`&&e&&n.children.push(r.nodeValue||``);return}if(r.nodeType!==Node.ELEMENT_NODE)return;let s=r,c=!a(s);if(!c)return;let l=[];if(s.hasAttribute(`aria-owns`)){let t=s.getAttribute(`aria-owns`).split(/\s+/);for(let n of t){let t=e.ownerDocument.getElementById(n);t&&l.push(t)}}let u=Pe(s);u&&n.children.push(u),i(u||n,s,l,c)};function i(e,t,n,i){let a=(ce(t)?.display||`inline`)!==`inline`||t.nodeName===`BR`?` `:``;a&&e.children.push(a),e.children.push(p(t,`::before`));let o=t.nodeName===`SLOT`?t.assignedNodes():[];if(o.length)for(let t of o)r(e,t,i);else{for(let n=t.firstChild;n;n=n.nextSibling)n.assignedSlot||r(e,n,i);if(t.shadowRoot)for(let n=t.shadowRoot.firstChild;n;n=n.nextSibling)r(e,n,i)}for(let t of n)r(e,t,i);if(e.children.push(p(t,`::after`)),a&&e.children.push(a),e.children.length===1&&e.name===e.children[0]&&(e.children=[]),e.role===`link`&&t.hasAttribute(`href`)){let n=t.getAttribute(`href`);e.props.url=n}if(e.role===`textbox`&&t.hasAttribute(`placeholder`)&&t.getAttribute(`placeholder`)!==e.name){let n=t.getAttribute(`placeholder`);e.props.placeholder=n}}h();try{r(n,e,!0)}finally{g()}return Fe(n),n}function Pe(e){let t=o(e)??null;if(!t||t===`presentation`||t===`none`)return null;let n={role:t,name:s(c(e,!1)||``),children:[],props:{},box:N,receivesPointerEvents:!0};if(l.includes(t)&&(n.checked=u(e)),d.includes(t)&&(n.disabled=f(e)||void 0),ee.includes(t)){let t=te(e);n.expanded=t===`none`?void 0:t}return ne.includes(t)&&(n.level=re(e)),ie.includes(t)&&(n.pressed=ae(e)),oe.includes(t)&&(n.selected=se(e)),(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.type!==`checkbox`&&e.type!==`radio`&&e.type!==`file`&&(n.children=[e.value]),n}function Fe(e){let t=(e,t)=>{if(!e.length)return;let n=s(e.join(``));n&&t.push(n),e.length=0},n=e=>{let r=[],i=[];for(let a of e.children||[])typeof a==`string`?i.push(a):(t(i,r),n(a),r.push(a));t(i,r),e.children=r.length?r:[],e.children.length===1&&e.children[0]===e.name&&(e.children=[])};n(e)}function P(e,t){let n=``;return e.level&&(n+=` [level=${e.level}]`),e.checked===!0&&(n+=` [checked]`),e.checked===`mixed`&&(n+=` [checked=mixed]`),e.disabled&&(n+=` [disabled]`),e.expanded===!0&&(n+=` [expanded]`),e.expanded,e.pressed===!0&&(n+=` [pressed]`),e.pressed===`mixed`&&(n+=` [pressed=mixed]`),e.selected&&(n+=` [selected]`),n}function Ie(e){let t=e.role;return e.name&&e.name.length<=900&&(t+=` ${JSON.stringify(e.name)}`),t+=P(e),t}function F(e,t,n){let r=Ie(e),i=Object.keys(e.props).length>0,a=e.children.length===1&&typeof e.children[0]==`string`&&!i?e.children[0]:void 0;if(!e.children.length&&!i)n.push(`${t}- ${r}`);else if(a!==void 0)n.push(`${t}- ${r}: ${M(a)}`);else{n.push(`${t}- ${r}:`);for(let[r,i]of Object.entries(e.props))n.push(`${t} - /${r}: ${M(i)}`);for(let r of e.children)typeof r==`string`?r&&n.push(`${t} - text: ${M(r)}`):F(r,`${t} `,n)}}function Le(e){let t=[],n=e.role===`fragment`?e.children:[e];for(let e of n)typeof e==`string`?e&&t.push(`- text: ${M(e)}`):F(e,``,t);return t.join(`
|
|
6
|
-
`)}function I(e){return w(e)?`/${e.raw.slice(1,-1)}/`:M(e.normalized)}function
|
|
7
|
-
`)}function
|
|
8
|
-
`)}}function
|
|
9
|
-
`)}function
|
|
10
|
-
`)}}class
|
|
11
|
-
`)}}}function
|
|
12
|
-
`)}}function
|
|
13
|
-
`)}}}function
|
|
14
|
-
`)}}}function
|
|
15
|
-
`)}}const
|
|
16
|
-
`)}}}function
|
|
17
|
-
`)}}}function
|
|
18
|
-
`)}}))}async function
|
|
19
|
-
`)}}}function
|
|
20
|
-
`)}}}function
|
|
21
|
-
`)}}}function
|
|
6
|
+
`)}function I(e){return w(e)?`/${e.raw.slice(1,-1)}/`:M(e.normalized)}function Re(e){return typeof e==`string`?JSON.stringify(e):`/${e.pattern}/`}function ze(e){let t=[];if(e.kind===`text`)t.push(`- text: ${I(e.text)}`);else if(e.role===`fragment`){e.containerMode&&e.containerMode!==`contain`&&t.push(`- /children: ${e.containerMode}`);for(let n of e.children||[])L(n,``,t)}else L(e,``,t);return t.join(`
|
|
7
|
+
`)}function Be(e){let t=e.role;return e.name!==void 0&&(t+=` ${Re(e.name)}`),t+=P(e),t}function L(e,t,n){if(e.kind===`text`){n.push(`${t}- text: ${I(e.text)}`);return}let r=Be(e),i=e.children||[],a=[];if(e.containerMode&&e.containerMode!==`contain`&&a.push(`${t} - /children: ${e.containerMode}`),e.props)for(let[n,r]of Object.entries(e.props))a.push(`${t} - /${n}: ${I(r)}`);if(i.length===0&&a.length===0){n.push(`${t}- ${r}`);return}if(i.length===1&&i[0].kind===`text`&&a.length===0){n.push(`${t}- ${r}: ${I(i[0].text)}`);return}n.push(`${t}- ${r}:`),n.push(...a);for(let e of i)L(e,`${t} `,n)}function Ve(e,t){let n=e.role===`fragment`?e.children:[e],r=R(t)?t.children??[]:[t],i=R(t)?t.containerMode:void 0,a=Ke(n,r,``,i);return a.pass&&i&&i!==`contain`&&a.resolved.unshift(`- /children: ${i}`),{pass:a.pass,resolved:a.resolved.join(`
|
|
8
|
+
`)}}function R(e){return e.kind===`role`&&e.role===`fragment`}function He(e){return typeof e==`object`&&!!e&&`pattern`in e}function Ue(e,t){let n=e.role;return t.name===void 0||(He(t.name)&&x(e.name,t.name)?n+=` ${Re(t.name)}`:e.name&&(n+=` ${JSON.stringify(e.name)}`)),t.level!==void 0&&(n+=` [level=${e.level}]`),t.checked!==void 0&&(e.checked===!0?n+=` [checked]`:e.checked===`mixed`&&(n+=` [checked=mixed]`)),t.disabled!==void 0&&e.disabled&&(n+=` [disabled]`),t.expanded!==void 0&&(e.expanded===!0?n+=` [expanded]`:e.expanded===!1&&(n+=` [expanded=false]`)),t.pressed!==void 0&&(e.pressed===!0?n+=` [pressed]`:e.pressed===`mixed`&&(n+=` [pressed=mixed]`)),t.selected!==void 0&&e.selected&&(n+=` [selected]`),n}function We(e,t){let n=new Map,r=0;for(let i=0;i<e.length&&r<t.length;i++)T(e[i],t[r],!1)&&(n.set(i,r),r++);return n}function Ge(e,t){let n=new Map,r=new Set;for(let i=0;i<t.length;i++)for(let a=0;a<e.length;a++)if(!r.has(a)&&T(e[a],t[i],!1)){n.set(a,i),r.add(a);break}return n}function z(e,t){let n=[];return typeof e==`string`?n.push(`${t}- text: ${e}`):F(e,t,n),n}function Ke(e,t,n,r){if(e.some(e=>typeof e!=`string`&&e.role===`fragment`)||t.some(e=>R(e)))throw Error(`Internal error: fragment wrappers must be unwrapped at matchAriaTree root`);if(r===`equal`||r===`deep-equal`)return qe(e,t,n,r===`deep-equal`);let i=[],a=We(e,t);if(t.length!==a.size){let r=Ge(e,t);for(let a=0;a<e.length;a++){let o=r.get(a);o===void 0?i.push(...z(e[a],n)):i.push(...B(e[a],t[o],n))}return{resolved:i,pass:!1}}for(let r=0;r<e.length;r++){let o=a.get(r);o!==void 0&&i.push(...B(e[r],t[o],n))}return{resolved:i,pass:!0}}function qe(e,t,n,r){let i=[],a=e.length===t.length&&e.every((e,n)=>T(e,t[n],r));for(let a=0;a<e.length;a++)a<t.length?i.push(...B(e[a],t[a],n,r)):i.push(...z(e[a],n));return{resolved:i,pass:a}}function B(e,t,n,r=!1){if(typeof e==`string`&&t.kind===`text`)return[`${n}- text: ${S(e,t.text)&&w(t.text)?I(t.text):e}`];if(typeof e==`string`||t.kind===`text`)return z(e,n);let i=Ue(e,t),a=Ke(e.children,t.children||[],`${n} `,t.containerMode??(r?`equal`:`contain`)),o=[];t.containerMode&&t.containerMode!==`contain`&&o.push(`${n} - /children: ${t.containerMode}`);let s=new Set([...Object.keys(e.props),...Object.keys(t.props||{})]);for(let r of s){let i=e.props[r],a=t.props?.[r];if(i!==void 0){let e=(a===void 0||S(i,a))&&a&&w(a)?I(a):i;o.push(`${n} - /${r}: ${e}`)}}let c=[];if(!a.resolved.length&&!o.length)c.push(`${n}- ${i}`);else if(a.resolved.length===1&&a.resolved[0].trimStart().startsWith(`- text: `)&&!o.length){let e=a.resolved[0].trimStart().slice(8);c.push(`${n}- ${i}: ${e}`)}else c.push(`${n}- ${i}:`),c.push(...o),c.push(...a.resolved);return c}function Je(e){return Se(De,e)}var Ye=Object.freeze({__proto__:null,generateAriaTree:Ne,matchAriaTree:Ve,parseAriaTemplate:Je,renderAriaTemplate:ze,renderAriaTree:Le});_().aria=Ye;const{generateAriaTree:Xe,matchAriaTree:Ze,parseAriaTemplate:Qe,renderAriaTemplate:$e,renderAriaTree:et}=Ye,tt={name:`aria`,capture(e){if(e instanceof Element)return Xe(e);throw TypeError(`aria adapter expects an Element`)},render(e){return V(et(e))},parseExpected(e){let t=Error.stackTraceLimit;Error.stackTraceLimit=t+20;try{return Qe(e.trim())}finally{Error.stackTraceLimit=t}},match(e,t){let n=Ze(e,t);return n.pass?{pass:!0}:{pass:!1,message:`Accessibility tree does not match expected template`,resolved:V(n.resolved),expected:V($e(t))}}};function V(e){return`\n${e}\n`}const nt={toMatchAriaSnapshot(t){return e.toMatchDomainSnapshot.call(this,tt,t)},toMatchAriaInlineSnapshot(t,n){return e.toMatchDomainInlineSnapshot.call(this,tt,t,n)}};for(let e of Object.values(nt))Object.assign(e,{__vitest_poll_takeover__:!0});function rt(){return[...l]}function it(e,t,n){return e instanceof v&&(e=e.query()),e==null?null:H(e,t,n)}function H(e,t,n){e instanceof v&&(e=e.element());let r=e?.ownerDocument?.defaultView||window;if(e instanceof r.HTMLElement||e instanceof r.SVGElement)return e;throw new ft(e,t,n)}function at(e,t,n){e instanceof v&&(e=e.element());let r=e.ownerDocument?.defaultView||window;if(e instanceof r.Node)return e;throw new pt(e,t,n)}function U(e,t,n,r,i,a){return[`${t}\n`,`${n}:\n${e.utils.EXPECTED_COLOR(W(lt(e,r),2))}`,`${i}:\n${e.utils.RECEIVED_COLOR(W(lt(e,a),2))}`].join(`
|
|
9
|
+
`)}function W(e,t){return ot(ct(e),t)}function ot(e,t){return e.replace(/^(?!\s*$)/gm,` `.repeat(t))}function st(e){let t=e.match(/^[ \t]*(?=\S)/gm);return t?t.reduce((e,t)=>Math.min(e,t.length),1/0):0}function ct(e){let t=st(e);if(t===0)return e;let n=RegExp(`^[ \\t]{${t}}`,`gm`);return e.replace(n,``)}function lt(e,t){return typeof t==`string`?t:e.utils.stringify(t)}function ut(e,{wordConnector:t=`, `,lastWordConnector:n=` and `}={}){return[e.slice(0,-1).join(t),e.at(-1)].join(e.length>1?n:``)}class dt extends Error{constructor(e,t,n,r){super(),Error.captureStackTrace&&Error.captureStackTrace(this,n);let i=``;try{i=r.utils.printWithType(`Received`,t,r.utils.printReceived)}catch{}this.message=[r.utils.matcherHint(`${r.isNot?`.not`:``}.${n.name}`,`received`,``),``,`${r.utils.RECEIVED_COLOR(`received`)} value must ${e} or a Locator that returns ${e}.`,i].join(`
|
|
10
|
+
`)}}class ft extends dt{constructor(e,t,n){super(`an HTMLElement or an SVGElement`,e,t,n)}}class pt extends dt{constructor(e,t,n){super(`a Node`,e,t,n)}}function G(e){return e instanceof HTMLFormElement?`FORM`:e.tagName.toUpperCase()}function K(e){return G(e)===`INPUT`}function mt(e){if(e)switch(G(e)){case`INPUT`:return gt(e);case`SELECT`:return ht(e);default:return e.value??vt(e)}}function ht({multiple:e,options:t}){let n=[...t].filter(e=>e.selected);if(e)return Array.from(n,e=>e.value);if(n.length!==0)return n[0].value}function gt(e){switch(e.type){case`number`:return e.value===``?null:Number(e.value);case`checkbox`:return e.checked;default:return e.value}}const _t=[`meter`,`progressbar`,`slider`,`spinbutton`];function vt(e){if(_t.includes(e.getAttribute(`role`)||``))return Number(e.getAttribute(`aria-valuenow`))}function yt(e){return e.replace(/\s+/g,` `).trim()}function bt(e,t){return t instanceof RegExp?t.test(e):e.includes(String(t))}function q(e,t){if(Array.isArray(e)&&Array.isArray(t)){let n=new Set(t);for(let t of new Set(e))if(!n.has(t))return!1;return!0}}const xt=rt();function St(e){let t=H(e,St,this);if(!(K(t)&&[`checkbox`,`radio`].includes(t.type))&&!(xt.includes(o(t)||``)&&[`true`,`false`].includes(t.getAttribute(`aria-checked`)||``)))return{pass:!1,message:()=>`only inputs with type="checkbox" or type="radio" or elements with ${Ct()} and a valid aria-checked attribute can be used with .toBeChecked(). Use .toHaveValue() instead`};let n=u(t)===!0;return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeChecked`,`element`,``),``,`Received element ${e} checked:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
11
|
+
`)}}}function Ct(){return ut(xt.map(e=>`role="${e}"`),{lastWordConnector:` or `})}function wt(e){let t=H(e,wt,this);return{pass:Tt(t),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEmptyDOMElement`,`element`,``),``,`Received:`,` ${this.utils.printReceived(t.innerHTML)}`].join(`
|
|
12
|
+
`)}}function Tt(e){return[...e.childNodes].filter(e=>e.nodeType!==Node.COMMENT_NODE).length===0}function Et(e){let t=H(e,Et,this),n=Ot(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeDisabled`,`element`,``),``,`Received element ${e} disabled:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
13
|
+
`)}}}function Dt(e){let t=H(e,Dt,this),n=Ot(t);return{pass:!n,message:()=>{let e=n?`is not`:`is`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeEnabled`,`element`,``),``,`Received element ${e} enabled:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
14
|
+
`)}}}function Ot(e){return G(e).includes(`-`)?e.hasAttribute(`disabled`):f(e)}function kt(e){let t=null;(e!==null||!this.isNot)&&(t=it(e,kt,this));let n=t!==null&&t.ownerDocument===t.getRootNode({composed:!0}),r=()=>`expected document not to contain element, found ${this.utils.stringify(t?.cloneNode(!0))} instead`,i=()=>`element could not be found in the document`;return{pass:n,message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInTheDocument`,`element`,``),``,this.utils.RECEIVED_COLOR(this.isNot?r():i())].join(`
|
|
15
|
+
`)}}const At=[`FORM`,`INPUT`,`SELECT`,`TEXTAREA`];function jt(e){return e.hasAttribute(`aria-invalid`)&&e.getAttribute(`aria-invalid`)!==`false`}function Mt(e){return At.includes(G(e))}function Nt(e){let t=jt(e);return Mt(e)?t||!e.checkValidity():t}function J(e){let t=H(e,J,this),n=Nt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInvalid`,`element`,``),``,`Received element ${e} currently invalid:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
16
|
+
`)}}}function Pt(e){let t=H(e,J,this),n=!Nt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeValid`,`element`,``),``,`Received element ${e} currently valid:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
17
|
+
`)}}}function Ft(e,t){let n=H(e,Ft,this),r=t?.ratio??0;return It(n,r).then(({pass:e,ratio:t})=>({pass:e,message:()=>{let i=e?`is`:`is not`,a=r>0?` with ratio ${r}`:``,o=t===void 0?``:` (actual ratio: ${t.toFixed(3)})`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeInViewport`,`element`,``),``,`Received element ${i} in viewport${a}${o}:`,` ${this.utils.printReceived(n.cloneNode(!1))}`].join(`
|
|
18
|
+
`)}}))}async function It(e,t){let n=await new Promise(t=>{let n=new IntersectionObserver(e=>{e.length>0?t(e[0].intersectionRatio):t(0),n.disconnect()});n.observe(e),requestAnimationFrame(()=>{})});return{pass:n>0&&n>t-1e-9,ratio:n}}function Lt(e){let t=H(e,Lt,this);if(!(K(t)&&t.type===`checkbox`)&&t.getAttribute(`role`)!==`checkbox`)return{pass:!1,message:()=>`only inputs with type="checkbox" or elements with role="checkbox" and a valid aria-checked attribute can be used with .toBePartiallyChecked(). Use .toHaveValue() instead`};let n=Rt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBePartiallyChecked`,`element`,``),``,`Received element ${e} partially checked:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
19
|
+
`)}}}function Rt(e){let t=u(e)===`mixed`;return!t&&K(e)&&[`checkbox`,`radio`].includes(e.type)&&e.getAttribute(`aria-checked`)===`mixed`?!0:t}const zt=[`SELECT`,`TEXTAREA`],Bt=[`INPUT`,`SELECT`,`TEXTAREA`],Vt=[`color`,`hidden`,`range`,`submit`,`image`,`reset`],Ht=[`checkbox`,`combobox`,`gridcell`,`listbox`,`radiogroup`,`spinbutton`,`textbox`,`tree`];function Ut(e){return zt.includes(G(e))&&e.hasAttribute(`required`)}function Wt(e){return G(e)===`INPUT`&&e.hasAttribute(`required`)&&(e.hasAttribute(`type`)&&!Vt.includes(e.getAttribute(`type`)||``)||!e.hasAttribute(`type`))}function Gt(e){return e.hasAttribute(`aria-required`)&&e.getAttribute(`aria-required`)===`true`&&(Bt.includes(G(e))||e.hasAttribute(`role`)&&Ht.includes(e.getAttribute(`role`)||``))}function Kt(e){let t=H(e,Kt,this),n=Ut(t)||Wt(t)||Gt(t);return{pass:n,message:()=>{let e=n?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeRequired`,`element`,``),``,`Received element ${e} required:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
20
|
+
`)}}}function qt(e){let t=H(e,qt,this),n=t.ownerDocument===t.getRootNode({composed:!0});h();let r=n&&Jt(t);return g(),{pass:r,message:()=>{let e=r?`is`:`is not`;return[this.utils.matcherHint(`${this.isNot?`.not`:``}.toBeVisible`,`element`,``),``,`Received element ${e} visible${n?``:` (element is not in the document)`}:`,` ${this.utils.printReceived(t.cloneNode(!1))}`].join(`
|
|
21
|
+
`)}}}function Jt(e){let t=le(e);if(ye.browser!==`webkit`)return t;let n=e.closest(`details`);return!n||e===n?t:Yt(e)}function Yt(e){let t=e;for(;t;){if(t.tagName===`DETAILS`){let n=t.querySelector(`summary`)===e;if(!t.open&&!n)return!1}t=t.parentElement}return e.offsetParent!==null}function Y(e,t){let n=H(e,Y,this),r=t===null?null:H(t,Y,this);return{pass:n.contains(r),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toContainElement`,`element`,`element`),``,this.utils.RECEIVED_COLOR(`${this.utils.stringify(n.cloneNode(!1))} ${this.isNot?`contains:`:`does not contain:`} ${this.utils.stringify(r?r.cloneNode(!1):null)}
|
|
22
22
|
`)].join(`
|
|
23
|
-
`)}}function
|
|
24
|
-
`)}}function
|
|
23
|
+
`)}}function Xt(e,t){let n=e.ownerDocument.createElement(`div`);return n.innerHTML=t,n.innerHTML}function Zt(e,t){let n=H(e,Zt,this);if(typeof t!=`string`)throw TypeError(`.toContainHTML() expects a string value, got ${t}`);return{pass:n.outerHTML.includes(Xt(n,t)),message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toContainHTML`,`element`,``),`Expected:`,` ${this.utils.EXPECTED_COLOR(t)}`,`Received:`,` ${this.utils.printReceived(n.cloneNode(!0))}`].join(`
|
|
24
|
+
`)}}function Qt(e,t){let n=H(e,Qt,this),r=ue(n,!1),i=n.ownerDocument.defaultView||window,a=arguments.length===1,o=!1;return o=a?r!==``:t instanceof i.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleDescription`,`element`,``),`Expected element ${e} have accessible description`,t,`Received`,r)}}}function $t(e,t){let n=H(e,$t,this),r=de(n)??``,i=n.ownerDocument.defaultView||window,a=arguments.length===1,o=!1;return o=a?r!==``:t instanceof i.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return t==null?[this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleErrorMessage`,`element`,``),`Expected element ${e} have accessible error message, but got${this.isNot?``:` nothing`}`,this.isNot?this.utils.RECEIVED_COLOR(W(r,2)):``].filter(Boolean).join(`
|
|
25
25
|
|
|
26
|
-
`):
|
|
27
|
-
`)}}function
|
|
28
|
-
`)}}function
|
|
26
|
+
`):U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAccessibleErrorMessage`,`element`,``),`Expected element ${e} have accessible error message`,t,`Received`,r)}}}function X(e,t){let n=H(e,X,this),r=c(n,!1),i=arguments.length===1,a=n.ownerDocument.defaultView||window,o=!1;return o=i?r!==``:t instanceof a.RegExp?t.test(r):this.equals(r,t,this.customTesters),{pass:o,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.${X.name}`,`element`,``),`Expected element ${e} have accessible name`,t,`Received`,r)}}}function en(e,t,n){let r=H(e,en,this),i=n!==void 0,a=r.hasAttribute(t),o=r.getAttribute(t);return{pass:i?a&&this.equals(o,n,this.customTesters):a,message:()=>{let e=this.isNot?`not to`:`to`,r=a?tn(this.utils.stringify,t,o):null,s=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveAttribute`,`element`,this.utils.printExpected(t),{secondArgument:i?this.utils.printExpected(n):void 0,comment:nn(this.utils.stringify,t,n)});return U(this,s,`Expected the element ${e} have attribute`,tn(this.utils.stringify,t,n),`Received`,r)}}}function tn(e,t,n){return n===void 0?t:`${t}=${e(n)}`}function nn(e,t,n){return n===void 0?`element.hasAttribute(${e(t)})`:`element.getAttribute(${e(t)}) === ${e(n)}`}function rn(e,...t){let n=H(e,rn,this),{expectedClassNames:r,options:i}=an(t),a=on(n.getAttribute(`class`)),o=r.reduce((e,t)=>e.concat(typeof t==`string`||!t?on(t):t),[]),s=o.some(e=>e instanceof RegExp);if(i.exact&&s)throw Error(`Exact option does not support RegExp expected class names`);return i.exact?{pass:sn(o,a)&&o.length===a.length,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(o.join(` `))),`Expected the element ${e} have EXACTLY defined classes`,o.join(` `),`Received`,a.join(` `))}}:o.length>0?{pass:sn(o,a),message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveClass`,`element`,this.utils.printExpected(o.join(` `))),`Expected the element ${e} have class`,o.join(` `),`Received`,a.join(` `))}}:{pass:this.isNot?a.length>0:!1,message:()=>this.isNot?U(this,this.utils.matcherHint(`.not.toHaveClass`,`element`,``),`Expected the element to have classes`,`(none)`,`Received`,a.join(` `)):[this.utils.matcherHint(`.toHaveClass`,`element`),`At least one expected class must be provided.`].join(`
|
|
27
|
+
`)}}function an(e){let t=e.pop(),n,r;return typeof t==`object`&&!(t instanceof RegExp)?(n=e,r=t):(n=e.concat(t),r={exact:!1}),{expectedClassNames:n,options:r}}function on(e){return e?e.split(/\s+/).filter(e=>e.length>0):[]}function sn(e,t){return e.every(e=>typeof e==`string`?t.includes(e):t.some(t=>e.test(t)))}function cn(e,t){let n=H(e,cn,this),r=G(n);if(![`SELECT`,`INPUT`,`TEXTAREA`].includes(r))throw Error(`.toHaveDisplayValue() currently supports only input, textarea or select elements, try with another matcher instead.`);if(K(n)&&[`radio`,`checkbox`].includes(n.type))throw Error(`.toHaveDisplayValue() currently does not support input[type="${n.type}"], try with another matcher instead.`);let i=ln(r,n),a=un(t),o=a.filter(e=>i.some(t=>e instanceof RegExp?e.test(t):this.equals(t,String(e),this.customTesters))).length,s=o===i.length,c=o===a.length;return{pass:s&&c,message:()=>U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveDisplayValue`,`element`,``),`Expected element ${this.isNot?`not `:``}to have display value`,t,`Received`,i)}}function ln(e,t){return e===`SELECT`?Array.from(t).filter(e=>e.selected).map(e=>e.textContent||``):[t.value]}function un(e){return Array.isArray(e)?e:[e]}function dn(e){let t=H(e,dn,this);return{pass:t.ownerDocument.activeElement===t,message:()=>[this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveFocus`,`element`,``),``,...this.isNot?[`Received element is focused:`,` ${this.utils.printReceived(t)}`]:[`Expected element with focus:`,` ${this.utils.printExpected(t)}`,`Received element with focus:`,` ${this.utils.printReceived(t.ownerDocument.activeElement)}`]].join(`
|
|
28
|
+
`)}}function fn(e,t){let n=H(e,fn,this),r=n.ownerDocument.defaultView||window;if(!(n instanceof r.HTMLFieldSetElement)&&!(n instanceof r.HTMLFormElement))throw TypeError(`toHaveFormValues must be called on a form or a fieldset, instead got ${G(n)}`);if(!t||typeof t!=`object`)throw TypeError(`toHaveFormValues must be called with an object of expected form values. Got ${t}`);let i=gn(n);return{pass:Object.entries(t).every(([e,t])=>this.equals(i[e],t,[q,...this.customTesters])),message:()=>{let e=this.isNot?`not to`:`to`,n=`${this.isNot?`.not`:``}.toHaveFormValues`,r={};for(let e in i)Object.hasOwn(t,e)&&(r[e]=i[e]);return[this.utils.matcherHint(n,`element`,``),`Expected the element ${e} have form values`,this.utils.diff(t,r)].join(`
|
|
29
29
|
|
|
30
|
-
`)}}}function
|
|
30
|
+
`)}}}function pn(e){let t=``;for(let n of e){if(t&&t!==n.type)throw Error(`Multiple form elements with the same name must be of the same type`);t=n.type}switch(t){case`radio`:{let t=e.find(e=>e.checked);return t?t.value:void 0}case`checkbox`:return e.filter(e=>e.checked).map(e=>e.value);default:return e.map(e=>e.value)}}function mn(e,t){let n=[...e.querySelectorAll(`[name="${fe(t)}"]`)];if(n.length!==0)switch(n.length){case 1:return mt(n[0]);default:return pn(n)}}function hn(e){return e.endsWith(`[]`)?e.slice(0,-2):e}function gn(e){let t={};for(let n of e.elements){if(!(`name`in n))continue;let r=n.name;t[hn(r)]=mn(e,r)}return t}function _n(e,t){let n=H(e,_n,this);h();let r=o(n);return g(),{pass:r===t,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveRole`,`element`,``),`Expected element ${e} have role`,t,`Received`,r)}}}function vn(e,t){let n=H(e,vn,this),r=t!==void 0;if(r&&typeof t!=`string`)throw Error(`expected selection must be a string or undefined`);let i=yn(n);return{pass:r?this.equals(i,t,[q,...this.customTesters]):!!i,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveSelection`,`element`,t);return U(this,n,`Expected the element ${e} have selection`,r?t:`(any)`,`Received`,i)}}}function yn(e){let t=e.ownerDocument.getSelection();if(!t)return``;if([`INPUT`,`TEXTAREA`].includes(G(e))){let t=e;return[`radio`,`checkbox`].includes(t.type)||t.selectionStart==null||t.selectionEnd==null?``:t.value.toString().substring(t.selectionStart,t.selectionEnd)}if(t.anchorNode===null||t.focusNode===null)return``;let n=t.getRangeAt(0),r=e.ownerDocument.createRange();if(t.containsNode(e,!1))r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r);else if(!(e.contains(t.anchorNode)&&e.contains(t.focusNode))){let i=e===n.startContainer||e.contains(n.startContainer),a=e===n.endContainer||e.contains(n.endContainer);t.removeAllRanges(),(i||a)&&(r.selectNodeContents(e),i&&r.setStart(n.startContainer,n.startOffset),a&&r.setEnd(n.endContainer,n.endOffset),t.addRange(r))}let i=t.toString();return t.removeAllRanges(),t.addRange(n),i}const Z=ye.config.browser.name,Q=new Set(`backgroundPosition.background-position.bottom.left.right.top.height.width.margin-bottom.marginBottom.margin-left.marginLeft.margin-right.marginRight.margin-top.marginTop.min-height.minHeight.min-width.minWidth.padding-bottom.padding-left.padding-right.padding-top.text-indent.paddingBottom.paddingLeft.paddingRight.paddingTop.textIndent`.split(`.`));function bn(e,t){let n=H(e,bn,this),{getComputedStyle:r}=n.ownerDocument.defaultView,i=typeof t==`object`?xn(t):Sn(t),a=r(n),o=new Set(Array.from(n.style));return{pass:wn(i,n,a,o),message:()=>{let e=`${this.isNot?`.not`:``}.toHaveStyle`,t=new Set(Object.keys(i)),r=Cn(Array.from(a).filter(e=>t.has(e)).reduce((e,t)=>(e[t]=(o.has(t)&&Q.has(t)?n.style:a)[t],e),{})),s=r===``?`Expected styles could not be parsed by the browser. Did you make a typo?`:this.utils.diff(Cn(i),r);return[this.utils.matcherHint(e,`element`,``),s].join(`
|
|
31
31
|
|
|
32
|
-
`)}}}function
|
|
33
|
-
`)}function
|
|
34
|
-
`),meta:{outcome:
|
|
32
|
+
`)}}}function xn(e){let t=Z===`chrome`||Z===`chromium`?document:document.implementation.createHTMLDocument(``),n=t.createElement(`div`);t.body.appendChild(n);let r=Object.keys(e);r.forEach(t=>{n.style[t]=e[t]});let i={},a=window.getComputedStyle(n);return r.forEach(e=>{let t=(Q.has(e)?n.style:a)[e];t!=null&&(i[e]=t)}),n.remove(),i}function Sn(e){let t=Z===`chrome`||Z===`chromium`||Z===`webkit`?document:document.implementation.createHTMLDocument(``),n=t.createElement(`div`);n.setAttribute(`style`,e.replace(/\n/g,``)),t.body.appendChild(n);let r=window.getComputedStyle(n),i=Array.from(n.style).reduce((e,t)=>(e[t]=Q.has(t)?n.style.getPropertyValue(t):r.getPropertyValue(t),e),{});return n.remove(),i}function Cn(e){return Object.keys(e).sort().map(t=>`${t}: ${e[t]};`).join(`
|
|
33
|
+
`)}function wn(e,t,n,r){let i=Object.keys(e);return i.length?i.every(i=>{let a=e[i],o=i.startsWith(`--`),s=[i];return o||s.push(i.toLowerCase()),s.some(e=>{let o=r.has(i)&&Q.has(i)?t.style:n;return o[e]===a||o.getPropertyValue(e)===a})}):!1}function Tn(e,t,n={normalizeWhitespace:!0}){let r=at(e,Tn,this),i=n.normalizeWhitespace?yt(r.textContent||``):(r.textContent||``).replace(/\u00A0/g,` `),a=String(t);return{pass:i===a,message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveTextContent`,`element`,``),`Expected element ${e} have text content`,a,`Received`,i)}}}function En(e,t){let n=H(e,En,this);if(K(n)&&[`checkbox`,`radio`].includes(n.type))throw Error(`input with type=checkbox or type=radio cannot be used with .toHaveValue(). Use .toBeChecked() for type=checkbox or .toHaveFormValues() instead`);let r=mt(n),i=t!==void 0,a=t,o=r;return t==r&&t!==r&&(a=`${t} (${typeof t})`,o=`${r} (${typeof r})`),{pass:i?this.equals(r,t,[q,...this.customTesters]):!!r,message:()=>{let e=this.isNot?`not to`:`to`,n=this.utils.matcherHint(`${this.isNot?`.not`:``}.toHaveValue`,`element`,t);return U(this,n,`Expected the element ${e} have value`,i?a:`(any)`,`Received`,o)}}}const $=new WeakMap([]);async function Dn(e,n,r=typeof n==`object`?n:{}){if(this.isNot)throw Error(`'toMatchScreenshot' cannot be used with "not"`);if(this.task===void 0||this.currentTestName===void 0)throw Error(`'toMatchScreenshot' cannot be used without test context`);let i=$.get(this.task);i===void 0&&(i={current:0},$.set(this.task,i),this.task.context.onTestFinished(e=>{$.delete(e.task)})),i.current+=1;let a=typeof n==`string`?n:`${this.currentTestName} ${i.current}`,o=On(e),[s,...c]=await Promise.all([o?void 0:pe(e,r),...r.screenshotOptions&&`mask`in r.screenshotOptions?r.screenshotOptions.mask.map(e=>pe(e,r)):[]]),l=r.screenshotOptions&&`mask`in r.screenshotOptions?{...r,screenshotOptions:{...r.screenshotOptions,mask:c}}:r,u=await _().commands.triggerCommand(`__vitest_screenshotMatcher`,[a,this.currentTestName,{element:s,target:o?`page`:`element`,...l}]);if(u.pass===!1){let e=[];u.reference&&e.push({name:`reference`,...u.reference}),u.actual&&e.push({name:`actual`,...u.actual}),u.diff&&e.push({name:`diff`,...u.diff}),e.length>0&&await t(this.task,{type:`internal:toMatchScreenshot`,kind:`visual-regression`,message:u.message,attachments:e})}return{pass:u.pass,message:()=>u.pass?``:[this.utils.matcherHint(`toMatchScreenshot`,o?`page`:`element`,``),``,u.message,u.reference?`\nReference screenshot:\n ${this.utils.EXPECTED_COLOR(u.reference.path)}`:null,u.actual?`\nActual screenshot:\n ${this.utils.RECEIVED_COLOR(u.actual.path)}`:null,u.diff?this.utils.DIM_COLOR(`\nDiff image:\n ${u.diff.path}`):null,``].filter(e=>e!==null).join(`
|
|
34
|
+
`),meta:{outcome:u.outcome}}}function On(e){return!!e&&typeof e==`object`&&`viewport`in e&&typeof e.viewport==`function`}function kn(e,t,n={normalizeWhitespace:!0}){let r=at(e,kn,this),i=n.normalizeWhitespace?yt(r.textContent||``):(r.textContent||``).replace(/\u00A0/g,` `),a=i!==``&&t===``;return{pass:!a&&bt(i,t),message:()=>{let e=this.isNot?`not to`:`to`;return U(this,this.utils.matcherHint(`${this.isNot?`.not`:``}.toMatchTextContent`,`element`,``),a?`Checking with empty string will always match, use .toBeEmptyDOMElement() instead`:`Expected element ${e} match text content`,t,`Received`,i)}}}const An={toBeDisabled:Et,toBeEnabled:Dt,toBeEmptyDOMElement:wt,toBeInTheDocument:kt,toBeInViewport:Ft,toBeInvalid:J,toBeRequired:Kt,toBeValid:Pt,toBeVisible:qt,toContainElement:Y,toContainHTML:Zt,toHaveAccessibleDescription:Qt,toHaveAccessibleErrorMessage:$t,toHaveAccessibleName:X,toHaveAttribute:en,toHaveClass:rn,toHaveFocus:dn,toHaveFormValues:fn,toHaveStyle:bn,toHaveTextContent:Tn,toMatchTextContent:kn,toHaveValue:En,toHaveDisplayValue:cn,toBeChecked:St,toBePartiallyChecked:Lt,toHaveRole:_n,toHaveSelection:vn,toMatchScreenshot:Dn},jn=Symbol.for(`$$vitest:locator`);function Mn(e,t){if(e!=null&&!(e instanceof HTMLElement)&&!(e instanceof SVGElement)&&!(jn in e))throw Error(`Invalid element or locator: ${e}. Expected an instance of HTMLElement, SVGElement or Locator, received ${i(e)}`);let a=me(t),o=a==null?t:{...t,timeout:a},s=o?.timeout?he()+o.timeout:void 0,c=n.poll(async function(){if(e instanceof Element||e==null)return e;let t=r.util.flag(this,`negate`),n=r.util.flag(this,`_name`);return t&&n===`toBeInTheDocument`?e.query():n===`toHaveLength`?e.elements():e.findElement({...o,timeout:s?Math.max(s-he(),0):void 0})},o);r.util.flag(c,`_poll.element`,!0),a!=null&&r.util.flag(c,`_poll.wrap`,(e,t)=>{let n=`expect.element().${r.util.flag(c,`_name`)}()`;return _().runner._deadline?.track(n,e,a,t)??e});let l=ge().current,u=!!l&&_().activeTraceTaskIds.has(l.id),d=!!l&&_().browserTraceAttempts.has(l.id);if(l&&(u||d)){let t=Error(`__vitest_mark_trace__`),n=d?_e():void 0,i=()=>!e||e instanceof Element?void 0:e.serialize(),a=(e,t)=>{let n=r.util.flag(e,`negate`),i=r.util.flag(e,`_name`)||`<unknown>`,a=`${n?`not.`:``}${i}`;return t===`fail`?`${a} [ERROR]`:a};r.util.flag(c,`_poll.onStart`,async e=>{d&&await ve(l,{name:a(e.assertion),kind:`expect`,range:{id:n,phase:`start`},element:i(),stack:t.stack})}),r.util.flag(c,`_poll.onSettled`,async e=>{let r=a(e.assertion,e.status);d&&await ve(l,{name:r,kind:`expect`,range:{id:n,phase:`end`},status:e.status,element:i(),stack:t.stack}),u&&await _().commands.triggerCommand(`__vitest_markTrace`,[{name:r,element:i(),stack:t.stack}],t)})}return c}n.extend(An),n.extend(nt),n.element=Mn;
|
package/dist/index.js
CHANGED
|
@@ -209,7 +209,7 @@ const basename = function(p, extension) {
|
|
|
209
209
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
210
210
|
};
|
|
211
211
|
|
|
212
|
-
var version = "5.0.
|
|
212
|
+
var version = "5.0.3";
|
|
213
213
|
|
|
214
214
|
const pkgRoot = resolve(fileURLToPath(import.meta.url), "../..");
|
|
215
215
|
const distRoot = resolve(pkgRoot, "dist");
|
|
@@ -1652,7 +1652,10 @@ const pixelmatch = (reference, actual, { createDiff, ...options }) => {
|
|
|
1652
1652
|
return {
|
|
1653
1653
|
pass,
|
|
1654
1654
|
diff: diffBuffer ?? null,
|
|
1655
|
-
message: pass ? null : `${mismatchedPixels} pixels (ratio ${
|
|
1655
|
+
message: pass ? null : `${mismatchedPixels} pixels (ratio ${
|
|
1656
|
+
// as we compare using `<=`, use `Math.ceil` to ensure the reported ratio
|
|
1657
|
+
// doesn't appear equal to the allowed limit when it's a bit over
|
|
1658
|
+
(Math.ceil(mismatchedPixels / imageArea * 100) / 100).toFixed(2)}) differ.`
|
|
1656
1659
|
};
|
|
1657
1660
|
};
|
|
1658
1661
|
|
|
@@ -2496,269 +2499,6 @@ class ParentBrowserProject {
|
|
|
2496
2499
|
}
|
|
2497
2500
|
}
|
|
2498
2501
|
|
|
2499
|
-
function _mergeNamespaces$1(n, m) {
|
|
2500
|
-
m.forEach(function(e) {
|
|
2501
|
-
e && typeof e !== "string" && !Array.isArray(e) && Object.keys(e).forEach(function(k) {
|
|
2502
|
-
if (k !== "default" && !(k in n)) {
|
|
2503
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
2504
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
2505
|
-
enumerable: true,
|
|
2506
|
-
get: function() {
|
|
2507
|
-
return e[k];
|
|
2508
|
-
}
|
|
2509
|
-
});
|
|
2510
|
-
}
|
|
2511
|
-
});
|
|
2512
|
-
});
|
|
2513
|
-
return Object.freeze(n);
|
|
2514
|
-
}
|
|
2515
|
-
function getDefaultExportFromCjs(x) {
|
|
2516
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
|
|
2517
|
-
}
|
|
2518
|
-
var reactIs$1 = { exports: {} };
|
|
2519
|
-
var reactIs_production = {};
|
|
2520
|
-
/**
|
|
2521
|
-
* @license React
|
|
2522
|
-
* react-is.production.js
|
|
2523
|
-
*
|
|
2524
|
-
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2525
|
-
*
|
|
2526
|
-
* This source code is licensed under the MIT license found in the
|
|
2527
|
-
* LICENSE file in the root directory of this source tree.
|
|
2528
|
-
*/
|
|
2529
|
-
var hasRequiredReactIs_production;
|
|
2530
|
-
function requireReactIs_production() {
|
|
2531
|
-
if (hasRequiredReactIs_production) return reactIs_production;
|
|
2532
|
-
hasRequiredReactIs_production = 1;
|
|
2533
|
-
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
2534
|
-
function typeOf(object) {
|
|
2535
|
-
if ("object" === typeof object && null !== object) {
|
|
2536
|
-
var $$typeof = object.$$typeof;
|
|
2537
|
-
switch ($$typeof) {
|
|
2538
|
-
case REACT_ELEMENT_TYPE: switch (object = object.type, object) {
|
|
2539
|
-
case REACT_FRAGMENT_TYPE:
|
|
2540
|
-
case REACT_PROFILER_TYPE:
|
|
2541
|
-
case REACT_STRICT_MODE_TYPE:
|
|
2542
|
-
case REACT_SUSPENSE_TYPE:
|
|
2543
|
-
case REACT_SUSPENSE_LIST_TYPE:
|
|
2544
|
-
case REACT_VIEW_TRANSITION_TYPE: return object;
|
|
2545
|
-
default: switch (object = object && object.$$typeof, object) {
|
|
2546
|
-
case REACT_CONTEXT_TYPE:
|
|
2547
|
-
case REACT_FORWARD_REF_TYPE:
|
|
2548
|
-
case REACT_LAZY_TYPE:
|
|
2549
|
-
case REACT_MEMO_TYPE: return object;
|
|
2550
|
-
case REACT_CONSUMER_TYPE: return object;
|
|
2551
|
-
default: return $$typeof;
|
|
2552
|
-
}
|
|
2553
|
-
}
|
|
2554
|
-
case REACT_PORTAL_TYPE: return $$typeof;
|
|
2555
|
-
}
|
|
2556
|
-
}
|
|
2557
|
-
}
|
|
2558
|
-
reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
2559
|
-
reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
|
|
2560
|
-
reactIs_production.Element = REACT_ELEMENT_TYPE;
|
|
2561
|
-
reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
2562
|
-
reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
2563
|
-
reactIs_production.Lazy = REACT_LAZY_TYPE;
|
|
2564
|
-
reactIs_production.Memo = REACT_MEMO_TYPE;
|
|
2565
|
-
reactIs_production.Portal = REACT_PORTAL_TYPE;
|
|
2566
|
-
reactIs_production.Profiler = REACT_PROFILER_TYPE;
|
|
2567
|
-
reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
2568
|
-
reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
2569
|
-
reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
2570
|
-
reactIs_production.isContextConsumer = function(object) {
|
|
2571
|
-
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
2572
|
-
};
|
|
2573
|
-
reactIs_production.isContextProvider = function(object) {
|
|
2574
|
-
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
2575
|
-
};
|
|
2576
|
-
reactIs_production.isElement = function(object) {
|
|
2577
|
-
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
2578
|
-
};
|
|
2579
|
-
reactIs_production.isForwardRef = function(object) {
|
|
2580
|
-
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
2581
|
-
};
|
|
2582
|
-
reactIs_production.isFragment = function(object) {
|
|
2583
|
-
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
2584
|
-
};
|
|
2585
|
-
reactIs_production.isLazy = function(object) {
|
|
2586
|
-
return typeOf(object) === REACT_LAZY_TYPE;
|
|
2587
|
-
};
|
|
2588
|
-
reactIs_production.isMemo = function(object) {
|
|
2589
|
-
return typeOf(object) === REACT_MEMO_TYPE;
|
|
2590
|
-
};
|
|
2591
|
-
reactIs_production.isPortal = function(object) {
|
|
2592
|
-
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
2593
|
-
};
|
|
2594
|
-
reactIs_production.isProfiler = function(object) {
|
|
2595
|
-
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
2596
|
-
};
|
|
2597
|
-
reactIs_production.isStrictMode = function(object) {
|
|
2598
|
-
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
2599
|
-
};
|
|
2600
|
-
reactIs_production.isSuspense = function(object) {
|
|
2601
|
-
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
2602
|
-
};
|
|
2603
|
-
reactIs_production.isSuspenseList = function(object) {
|
|
2604
|
-
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
2605
|
-
};
|
|
2606
|
-
reactIs_production.isValidElementType = function(type) {
|
|
2607
|
-
return "string" === typeof type || "function" === typeof type || type === REACT_FRAGMENT_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || "object" === typeof type && null !== type && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_CONSUMER_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_CLIENT_REFERENCE || void 0 !== type.getModuleId) ? true : false;
|
|
2608
|
-
};
|
|
2609
|
-
reactIs_production.typeOf = typeOf;
|
|
2610
|
-
return reactIs_production;
|
|
2611
|
-
}
|
|
2612
|
-
var hasRequiredReactIs$1;
|
|
2613
|
-
function requireReactIs$1() {
|
|
2614
|
-
if (hasRequiredReactIs$1) return reactIs$1.exports;
|
|
2615
|
-
hasRequiredReactIs$1 = 1;
|
|
2616
|
-
{
|
|
2617
|
-
reactIs$1.exports = requireReactIs_production();
|
|
2618
|
-
}
|
|
2619
|
-
return reactIs$1.exports;
|
|
2620
|
-
}
|
|
2621
|
-
var reactIsExports$1 = requireReactIs$1();
|
|
2622
|
-
var index$1 = /*@__PURE__*/ getDefaultExportFromCjs(reactIsExports$1);
|
|
2623
|
-
var ReactIs19 = /*#__PURE__*/ _mergeNamespaces$1({
|
|
2624
|
-
__proto__: null,
|
|
2625
|
-
default: index$1
|
|
2626
|
-
}, [reactIsExports$1]);
|
|
2627
|
-
var reactIs = { exports: {} };
|
|
2628
|
-
var reactIs_production_min = {};
|
|
2629
|
-
/**
|
|
2630
|
-
* @license React
|
|
2631
|
-
* react-is.production.min.js
|
|
2632
|
-
*
|
|
2633
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
2634
|
-
*
|
|
2635
|
-
* This source code is licensed under the MIT license found in the
|
|
2636
|
-
* LICENSE file in the root directory of this source tree.
|
|
2637
|
-
*/
|
|
2638
|
-
var hasRequiredReactIs_production_min;
|
|
2639
|
-
function requireReactIs_production_min() {
|
|
2640
|
-
if (hasRequiredReactIs_production_min) return reactIs_production_min;
|
|
2641
|
-
hasRequiredReactIs_production_min = 1;
|
|
2642
|
-
var b = Symbol.for("react.element"), c = Symbol.for("react.portal"), d = Symbol.for("react.fragment"), e = Symbol.for("react.strict_mode"), f = Symbol.for("react.profiler"), g = Symbol.for("react.provider"), h = Symbol.for("react.context"), k = Symbol.for("react.server_context"), l = Symbol.for("react.forward_ref"), m = Symbol.for("react.suspense"), n = Symbol.for("react.suspense_list"), p = Symbol.for("react.memo"), q = Symbol.for("react.lazy"), t = Symbol.for("react.offscreen"), u;
|
|
2643
|
-
u = Symbol.for("react.module.reference");
|
|
2644
|
-
function v(a) {
|
|
2645
|
-
if ("object" === typeof a && null !== a) {
|
|
2646
|
-
var r = a.$$typeof;
|
|
2647
|
-
switch (r) {
|
|
2648
|
-
case b: switch (a = a.type, a) {
|
|
2649
|
-
case d:
|
|
2650
|
-
case f:
|
|
2651
|
-
case e:
|
|
2652
|
-
case m:
|
|
2653
|
-
case n: return a;
|
|
2654
|
-
default: switch (a = a && a.$$typeof, a) {
|
|
2655
|
-
case k:
|
|
2656
|
-
case h:
|
|
2657
|
-
case l:
|
|
2658
|
-
case q:
|
|
2659
|
-
case p:
|
|
2660
|
-
case g: return a;
|
|
2661
|
-
default: return r;
|
|
2662
|
-
}
|
|
2663
|
-
}
|
|
2664
|
-
case c: return r;
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
}
|
|
2668
|
-
reactIs_production_min.ContextConsumer = h;
|
|
2669
|
-
reactIs_production_min.ContextProvider = g;
|
|
2670
|
-
reactIs_production_min.Element = b;
|
|
2671
|
-
reactIs_production_min.ForwardRef = l;
|
|
2672
|
-
reactIs_production_min.Fragment = d;
|
|
2673
|
-
reactIs_production_min.Lazy = q;
|
|
2674
|
-
reactIs_production_min.Memo = p;
|
|
2675
|
-
reactIs_production_min.Portal = c;
|
|
2676
|
-
reactIs_production_min.Profiler = f;
|
|
2677
|
-
reactIs_production_min.StrictMode = e;
|
|
2678
|
-
reactIs_production_min.Suspense = m;
|
|
2679
|
-
reactIs_production_min.SuspenseList = n;
|
|
2680
|
-
reactIs_production_min.isAsyncMode = function() {
|
|
2681
|
-
return false;
|
|
2682
|
-
};
|
|
2683
|
-
reactIs_production_min.isConcurrentMode = function() {
|
|
2684
|
-
return false;
|
|
2685
|
-
};
|
|
2686
|
-
reactIs_production_min.isContextConsumer = function(a) {
|
|
2687
|
-
return v(a) === h;
|
|
2688
|
-
};
|
|
2689
|
-
reactIs_production_min.isContextProvider = function(a) {
|
|
2690
|
-
return v(a) === g;
|
|
2691
|
-
};
|
|
2692
|
-
reactIs_production_min.isElement = function(a) {
|
|
2693
|
-
return "object" === typeof a && null !== a && a.$$typeof === b;
|
|
2694
|
-
};
|
|
2695
|
-
reactIs_production_min.isForwardRef = function(a) {
|
|
2696
|
-
return v(a) === l;
|
|
2697
|
-
};
|
|
2698
|
-
reactIs_production_min.isFragment = function(a) {
|
|
2699
|
-
return v(a) === d;
|
|
2700
|
-
};
|
|
2701
|
-
reactIs_production_min.isLazy = function(a) {
|
|
2702
|
-
return v(a) === q;
|
|
2703
|
-
};
|
|
2704
|
-
reactIs_production_min.isMemo = function(a) {
|
|
2705
|
-
return v(a) === p;
|
|
2706
|
-
};
|
|
2707
|
-
reactIs_production_min.isPortal = function(a) {
|
|
2708
|
-
return v(a) === c;
|
|
2709
|
-
};
|
|
2710
|
-
reactIs_production_min.isProfiler = function(a) {
|
|
2711
|
-
return v(a) === f;
|
|
2712
|
-
};
|
|
2713
|
-
reactIs_production_min.isStrictMode = function(a) {
|
|
2714
|
-
return v(a) === e;
|
|
2715
|
-
};
|
|
2716
|
-
reactIs_production_min.isSuspense = function(a) {
|
|
2717
|
-
return v(a) === m;
|
|
2718
|
-
};
|
|
2719
|
-
reactIs_production_min.isSuspenseList = function(a) {
|
|
2720
|
-
return v(a) === n;
|
|
2721
|
-
};
|
|
2722
|
-
reactIs_production_min.isValidElementType = function(a) {
|
|
2723
|
-
return "string" === typeof a || "function" === typeof a || a === d || a === f || a === e || a === m || a === n || a === t || "object" === typeof a && null !== a && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || void 0 !== a.getModuleId) ? true : false;
|
|
2724
|
-
};
|
|
2725
|
-
reactIs_production_min.typeOf = v;
|
|
2726
|
-
return reactIs_production_min;
|
|
2727
|
-
}
|
|
2728
|
-
var hasRequiredReactIs;
|
|
2729
|
-
function requireReactIs() {
|
|
2730
|
-
if (hasRequiredReactIs) return reactIs.exports;
|
|
2731
|
-
hasRequiredReactIs = 1;
|
|
2732
|
-
{
|
|
2733
|
-
reactIs.exports = requireReactIs_production_min();
|
|
2734
|
-
}
|
|
2735
|
-
return reactIs.exports;
|
|
2736
|
-
}
|
|
2737
|
-
var reactIsExports = requireReactIs();
|
|
2738
|
-
var index = /*@__PURE__*/ getDefaultExportFromCjs(reactIsExports);
|
|
2739
|
-
var ReactIs18 = /*#__PURE__*/ _mergeNamespaces$1({
|
|
2740
|
-
__proto__: null,
|
|
2741
|
-
default: index
|
|
2742
|
-
}, [reactIsExports]);
|
|
2743
|
-
const reactIsMethods = [
|
|
2744
|
-
"isAsyncMode",
|
|
2745
|
-
"isConcurrentMode",
|
|
2746
|
-
"isContextConsumer",
|
|
2747
|
-
"isContextProvider",
|
|
2748
|
-
"isElement",
|
|
2749
|
-
"isForwardRef",
|
|
2750
|
-
"isFragment",
|
|
2751
|
-
"isLazy",
|
|
2752
|
-
"isMemo",
|
|
2753
|
-
"isPortal",
|
|
2754
|
-
"isProfiler",
|
|
2755
|
-
"isStrictMode",
|
|
2756
|
-
"isSuspense",
|
|
2757
|
-
"isSuspenseList",
|
|
2758
|
-
"isValidElementType"
|
|
2759
|
-
];
|
|
2760
|
-
Object.fromEntries(reactIsMethods.map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)]));
|
|
2761
|
-
|
|
2762
2502
|
var naturalCompare = {exports: {}};
|
|
2763
2503
|
|
|
2764
2504
|
var hasRequiredNaturalCompare;
|
|
@@ -2829,7 +2569,7 @@ requireNaturalCompare();
|
|
|
2829
2569
|
function evaluateSnapshotFile(filepath, content) {
|
|
2830
2570
|
const data = Object.create(null);
|
|
2831
2571
|
try {
|
|
2832
|
-
//
|
|
2572
|
+
// oxlint-disable-next-line no-new-func
|
|
2833
2573
|
const populate = new Function("exports", content);
|
|
2834
2574
|
populate(data);
|
|
2835
2575
|
} catch (cause) {
|
|
@@ -3213,7 +2953,7 @@ function setupBrowserRpc(globalServer, defaultMockerRegistry) {
|
|
|
3213
2953
|
for (const attachment of attachments) {
|
|
3214
2954
|
const path = attachment.path;
|
|
3215
2955
|
if (path && !path.startsWith("http://") && !path.startsWith("https://")) {
|
|
3216
|
-
checkFileAccess(resolve(project.config.root, path));
|
|
2956
|
+
checkFileAccess(resolve(project.config.root, slash(path)));
|
|
3217
2957
|
}
|
|
3218
2958
|
}
|
|
3219
2959
|
}
|
|
@@ -3223,7 +2963,7 @@ function setupBrowserRpc(globalServer, defaultMockerRegistry) {
|
|
|
3223
2963
|
return vitest._testRun.recordBenchmark(testId, benchmark);
|
|
3224
2964
|
},
|
|
3225
2965
|
async readBenchmarkResult(relativePath) {
|
|
3226
|
-
checkFileAccess(project.benchmark.resolve(relativePath));
|
|
2966
|
+
checkFileAccess(project.benchmark.resolve(slash(relativePath)));
|
|
3227
2967
|
return project.benchmark.readResult(relativePath);
|
|
3228
2968
|
},
|
|
3229
2969
|
async writeBenchmarkResult(relativePath, data) {
|
|
@@ -3231,7 +2971,7 @@ function setupBrowserRpc(globalServer, defaultMockerRegistry) {
|
|
|
3231
2971
|
vitest.logger.error(`[vitest] Cannot write benchmark artifact "${relativePath}" because file writing is disabled. See https://vitest.dev/config/api.`);
|
|
3232
2972
|
return;
|
|
3233
2973
|
}
|
|
3234
|
-
checkFileAccess(project.benchmark.resolve(relativePath));
|
|
2974
|
+
checkFileAccess(project.benchmark.resolve(slash(relativePath)));
|
|
3235
2975
|
return project.benchmark.writeResult(relativePath, data);
|
|
3236
2976
|
},
|
|
3237
2977
|
async onTaskUpdate(method, packs, events) {
|
|
@@ -3383,8 +3123,9 @@ function setupBrowserRpc(globalServer, defaultMockerRegistry) {
|
|
|
3383
3123
|
} else {
|
|
3384
3124
|
if (module.type === "redirect") {
|
|
3385
3125
|
const redirectUrl = new URL(module.redirect);
|
|
3386
|
-
|
|
3387
|
-
checkFileAccess(
|
|
3126
|
+
const redirect = join(vite.config.root, slash(redirectUrl.pathname));
|
|
3127
|
+
checkFileAccess(redirect);
|
|
3128
|
+
module.redirect = redirect;
|
|
3388
3129
|
}
|
|
3389
3130
|
defaultMockerRegistry.register(module);
|
|
3390
3131
|
}
|
|
@@ -3590,7 +3331,7 @@ body {
|
|
|
3590
3331
|
configureServer(server) {
|
|
3591
3332
|
const parentServer = contribution.parent;
|
|
3592
3333
|
parentServer.setServer(server);
|
|
3593
|
-
//
|
|
3334
|
+
// oxlint-disable-next-line prefer-arrow-callback
|
|
3594
3335
|
server.middlewares.use(function vitestHeaders(_req, res, next) {
|
|
3595
3336
|
const headers = server.config.server.headers;
|
|
3596
3337
|
if (headers) {
|
package/jest-dom.d.ts
CHANGED
|
@@ -266,17 +266,39 @@ export interface TestingLibraryMatchers<R extends void | Promise<void>, T = unkn
|
|
|
266
266
|
* await expect.element(noClasses).not.toHaveClass()
|
|
267
267
|
* @see https://vitest.dev/api/browser/assertions#tohaveclass
|
|
268
268
|
*/
|
|
269
|
-
toHaveClass(
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
269
|
+
toHaveClass(
|
|
270
|
+
...classNames:
|
|
271
|
+
| (string | RegExp)[]
|
|
272
|
+
| [string, options?: { exact: boolean }]
|
|
273
|
+
| [string, string, options?: { exact: boolean }]
|
|
274
|
+
| [string, string, string, options?: { exact: boolean }]
|
|
275
|
+
| [string, string, string, string, options?: { exact: boolean }]
|
|
276
|
+
| [string, string, string, string, string, options?: { exact: boolean }]
|
|
277
|
+
| [string, string, string, string, string, string, options?: { exact: boolean }]
|
|
278
|
+
| [string, string, string, string, string, string, string, options?: { exact: boolean }]
|
|
279
|
+
| [
|
|
280
|
+
string,
|
|
281
|
+
string,
|
|
282
|
+
string,
|
|
283
|
+
string,
|
|
284
|
+
string,
|
|
285
|
+
string,
|
|
286
|
+
string,
|
|
287
|
+
string,
|
|
288
|
+
options?: { exact: boolean },
|
|
289
|
+
]
|
|
290
|
+
| [
|
|
291
|
+
string,
|
|
292
|
+
string,
|
|
293
|
+
string,
|
|
294
|
+
string,
|
|
295
|
+
string,
|
|
296
|
+
string,
|
|
297
|
+
string,
|
|
298
|
+
string,
|
|
299
|
+
string,
|
|
300
|
+
options?: { exact: boolean },
|
|
301
|
+
]
|
|
280
302
|
): R
|
|
281
303
|
/**
|
|
282
304
|
* @description
|
|
@@ -392,10 +414,7 @@ export interface TestingLibraryMatchers<R extends void | Promise<void>, T = unkn
|
|
|
392
414
|
* await expect.element(element).not.toHaveTextContent('Content')
|
|
393
415
|
* @see https://vitest.dev/api/browser/assertions#tohavetextcontent
|
|
394
416
|
*/
|
|
395
|
-
toHaveTextContent(
|
|
396
|
-
text: string | number,
|
|
397
|
-
options?: {normalizeWhitespace: boolean},
|
|
398
|
-
): R
|
|
417
|
+
toHaveTextContent(text: string | number, options?: { normalizeWhitespace: boolean }): R
|
|
399
418
|
/**
|
|
400
419
|
* @description
|
|
401
420
|
* Check whether the given element has a text content or not.
|
|
@@ -418,10 +437,7 @@ export interface TestingLibraryMatchers<R extends void | Promise<void>, T = unkn
|
|
|
418
437
|
* await expect.element(element).not.toMatchTextContent('content')
|
|
419
438
|
* @see https://vitest.dev/api/browser/assertions#tomatchtextcontent
|
|
420
439
|
*/
|
|
421
|
-
toMatchTextContent(
|
|
422
|
-
text: string | number | RegExp,
|
|
423
|
-
options?: {normalizeWhitespace: boolean},
|
|
424
|
-
): R
|
|
440
|
+
toMatchTextContent(text: string | number | RegExp, options?: { normalizeWhitespace: boolean }): R
|
|
425
441
|
/**
|
|
426
442
|
* @description
|
|
427
443
|
* Check whether the given form element has the specified value.
|
|
@@ -771,7 +787,7 @@ export interface TestingLibraryMatchers<R extends void | Promise<void>, T = unkn
|
|
|
771
787
|
* @see https://vitest.dev/guide/browser/aria-snapshots
|
|
772
788
|
* @see https://vitest.dev/api/expect#tomatchariasnapshot
|
|
773
789
|
*/
|
|
774
|
-
toMatchAriaSnapshot
|
|
790
|
+
toMatchAriaSnapshot(): R
|
|
775
791
|
/**
|
|
776
792
|
* @experimental
|
|
777
793
|
* @description
|
|
@@ -802,5 +818,5 @@ export interface TestingLibraryMatchers<R extends void | Promise<void>, T = unkn
|
|
|
802
818
|
* @see https://vitest.dev/guide/browser/aria-snapshots
|
|
803
819
|
* @see https://vitest.dev/api/expect#tomatchariaInlinesnapshot
|
|
804
820
|
*/
|
|
805
|
-
toMatchAriaInlineSnapshot
|
|
821
|
+
toMatchAriaInlineSnapshot(inlineSnapshot?: string): R
|
|
806
822
|
}
|
package/matchers.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import type { Assertion, ExpectPollOptions } from 'vitest'
|
|
1
2
|
import type { Locator } from './context.js'
|
|
2
3
|
import type { TestingLibraryMatchers } from './jest-dom.js'
|
|
3
|
-
import type { Assertion, ExpectPollOptions } from 'vitest'
|
|
4
4
|
|
|
5
5
|
declare module 'vitest' {
|
|
6
6
|
interface Assertion<R, T> extends TestingLibraryMatchers<R, T> {}
|
|
@@ -12,10 +12,10 @@ declare module 'vitest' {
|
|
|
12
12
|
* You can set default timeout via `expect.poll.timeout` option in the config.
|
|
13
13
|
* @see {@link https://vitest.dev/api/expect#poll}
|
|
14
14
|
*/
|
|
15
|
-
element: <T extends HTMLElement | SVGElement | null | Locator>(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
>
|
|
15
|
+
element: <T extends HTMLElement | SVGElement | null | Locator>(
|
|
16
|
+
element: T,
|
|
17
|
+
options?: ExpectPollOptions,
|
|
18
|
+
) => Assertion<Promise<void>, HTMLElement | SVGElement | null>
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vitest/browser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "5.0.
|
|
4
|
+
"version": "5.0.3",
|
|
5
5
|
"description": "Browser running for Vitest",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"funding": "https://opencollective.com/vitest",
|
|
@@ -63,13 +63,13 @@
|
|
|
63
63
|
"providers"
|
|
64
64
|
],
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"vitest": "5.0.
|
|
66
|
+
"vitest": "5.0.3"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"@blazediff/core": "1.10.0",
|
|
70
|
-
"@vitest/mocker": "5.0.
|
|
71
|
-
"@vitest/ui": "5.0.
|
|
72
|
-
"@vitest/utils": "5.0.
|
|
70
|
+
"@vitest/mocker": "5.0.3",
|
|
71
|
+
"@vitest/ui": "5.0.3",
|
|
72
|
+
"@vitest/utils": "5.0.3",
|
|
73
73
|
"magic-string": "^1.2.3",
|
|
74
74
|
"pngjs": "^7.0.0",
|
|
75
75
|
"sirv": "^3.0.2",
|
|
@@ -82,14 +82,14 @@
|
|
|
82
82
|
"@types/node": "24.13.3",
|
|
83
83
|
"@types/pngjs": "^6.0.5",
|
|
84
84
|
"@types/ws": "^8.18.1",
|
|
85
|
-
"@vitest/snapshot": "5.0.
|
|
85
|
+
"@vitest/snapshot": "5.0.3",
|
|
86
86
|
"birpc": "^4.2.0",
|
|
87
87
|
"flatted": "^3.4.4",
|
|
88
88
|
"ivya": "^1.8.2",
|
|
89
89
|
"mime": "^4.1.0",
|
|
90
90
|
"pathe": "^2.0.3",
|
|
91
91
|
"rrweb-snapshot": "2.1.1",
|
|
92
|
-
"vitest": "5.0.
|
|
92
|
+
"vitest": "5.0.3"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"typecheck": "tsc -p ./src/client/tsconfig.json --noEmit",
|
package/utils.d.ts
CHANGED