@vitest/browser 4.1.0-beta.5 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/context.d.ts +27 -5
- package/dist/client/.vite/manifest.json +1 -1
- package/dist/client/__vitest__/assets/{index-vKQ25zpc.js → index-Di71CKDo.js} +26 -26
- package/dist/client/__vitest__/index.html +1 -1
- package/dist/client/__vitest_browser__/{tester-C0ZOZX6s.js → tester-K5NNxh1O.js} +75 -31
- package/dist/client/tester/tester.html +1 -1
- package/dist/client.js +19 -12
- package/dist/context.js +32 -2
- package/dist/expect-element.js +23 -23
- package/dist/index-5Pe7X7sp.js +7 -0
- package/dist/index.d.ts +19 -1
- package/dist/index.js +5628 -16
- package/dist/locators.d.ts +2 -1
- package/dist/locators.js +1 -1
- package/package.json +14 -8
- package/dist/index-BvKPfXh9.js +0 -7
package/README.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# @vitest/browser
|
|
2
2
|
|
|
3
|
-
[](https://
|
|
3
|
+
[](https://npmx.dev/package/@vitest/browser)
|
|
4
4
|
|
|
5
5
|
This package exposes utilities to make your own browser provider. If you just need to run tests in the browser, consider installing one of these packages instead:
|
|
6
6
|
|
|
7
|
-
- [@vitest/browser-playwright](https://
|
|
8
|
-
- [@vitest/browser-webdriverio](https://
|
|
9
|
-
- [@vitest/browser-preview](https://
|
|
7
|
+
- [@vitest/browser-playwright](https://npmx.dev/package/@vitest/browser-playwright) - run tests using [playwright](https://playwright.dev/)
|
|
8
|
+
- [@vitest/browser-webdriverio](https://npmx.dev/package/@vitest/browser-webdriverio) - run tests using [webdriverio](https://webdriver.io/)
|
|
9
|
+
- [@vitest/browser-preview](https://npmx.dev/package/@vitest/browser-preview) to see how your tests look like in a real browser.
|
|
10
10
|
|
|
11
11
|
[GitHub](https://github.com/vitest-dev/vitest) | [Documentation](https://vitest.dev/guide/browser/)
|
package/context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SerializedConfig } from 'vitest'
|
|
2
|
-
import { StringifyOptions, BrowserCommands } from 'vitest/internal/browser'
|
|
2
|
+
import { StringifyOptions, CDPSession, BrowserCommands } from 'vitest/internal/browser'
|
|
3
3
|
import { ARIARole } from './aria-role.js'
|
|
4
4
|
import {} from './matchers.js'
|
|
5
5
|
|
|
@@ -17,9 +17,7 @@ export type BufferEncoding =
|
|
|
17
17
|
| 'binary'
|
|
18
18
|
| 'hex'
|
|
19
19
|
|
|
20
|
-
export
|
|
21
|
-
// methods are defined by the provider type augmentation
|
|
22
|
-
}
|
|
20
|
+
export { CDPSession };
|
|
23
21
|
|
|
24
22
|
export interface ScreenshotOptions extends SelectorOptions {
|
|
25
23
|
/**
|
|
@@ -43,6 +41,14 @@ export interface ScreenshotOptions extends SelectorOptions {
|
|
|
43
41
|
save?: boolean
|
|
44
42
|
}
|
|
45
43
|
|
|
44
|
+
export interface MarkOptions {
|
|
45
|
+
/**
|
|
46
|
+
* Optional stack string used to resolve marker location.
|
|
47
|
+
* Useful for wrapper libraries that need to forward the end-user callsite.
|
|
48
|
+
*/
|
|
49
|
+
stack?: string
|
|
50
|
+
}
|
|
51
|
+
|
|
46
52
|
interface StandardScreenshotComparators {
|
|
47
53
|
pixelmatch: {
|
|
48
54
|
/**
|
|
@@ -489,7 +495,7 @@ export interface LocatorByRoleOptions extends LocatorOptions {
|
|
|
489
495
|
selected?: boolean
|
|
490
496
|
}
|
|
491
497
|
|
|
492
|
-
interface LocatorScreenshotOptions extends Omit<ScreenshotOptions, 'element'> {}
|
|
498
|
+
export interface LocatorScreenshotOptions extends Omit<ScreenshotOptions, 'element'> {}
|
|
493
499
|
|
|
494
500
|
export interface LocatorSelectors {
|
|
495
501
|
/**
|
|
@@ -653,6 +659,12 @@ export interface Locator extends LocatorSelectors {
|
|
|
653
659
|
}>
|
|
654
660
|
screenshot(options?: LocatorScreenshotOptions): Promise<string>
|
|
655
661
|
|
|
662
|
+
/**
|
|
663
|
+
* Add a trace marker for this locator when browser tracing is enabled.
|
|
664
|
+
* @see {@link https://vitest.dev/api/browser/locators#mark}
|
|
665
|
+
*/
|
|
666
|
+
mark(name: string, options?: MarkOptions): Promise<void>
|
|
667
|
+
|
|
656
668
|
/**
|
|
657
669
|
* Returns an element matching the selector.
|
|
658
670
|
*
|
|
@@ -816,6 +828,16 @@ export interface BrowserPage extends LocatorSelectors {
|
|
|
816
828
|
path: string
|
|
817
829
|
base64: string
|
|
818
830
|
}>
|
|
831
|
+
/**
|
|
832
|
+
* Add a trace marker when browser tracing is enabled.
|
|
833
|
+
* @see {@link https://vitest.dev/api/browser/context#mark}
|
|
834
|
+
*/
|
|
835
|
+
mark(name: string, options?: MarkOptions): Promise<void>
|
|
836
|
+
/**
|
|
837
|
+
* Group multiple operations under a trace marker when browser tracing is enabled.
|
|
838
|
+
* @see {@link https://vitest.dev/api/browser/context#mark}
|
|
839
|
+
*/
|
|
840
|
+
mark<T>(name: string, body: () => T | Promise<T>, options?: MarkOptions): Promise<T>
|
|
819
841
|
/**
|
|
820
842
|
* Extend default `page` object with custom methods.
|
|
821
843
|
*/
|