vitest-browser-vue 2.0.1 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as render, i as config, n as RenderResult, r as cleanup, t as ComponentRenderOptions } from "./pure-
|
|
1
|
+
import { a as render, i as config, n as RenderResult, r as cleanup, t as ComponentRenderOptions } from "./pure-CE5Uqrcq.js";
|
|
2
2
|
|
|
3
3
|
//#region src/index.d.ts
|
|
4
4
|
declare module "vitest/browser" {
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { ComponentMountingOptions, config } from "@vue/test-utils";
|
|
|
3
3
|
import { DefineComponent } from "vue";
|
|
4
4
|
|
|
5
5
|
//#region src/pure.d.ts
|
|
6
|
-
type ComponentProps<T$1> = T$1 extends (new (...
|
|
6
|
+
type ComponentProps<T$1> = T$1 extends (new (...args: any) => {
|
|
7
7
|
$props: infer P;
|
|
8
8
|
}) ? NonNullable<P> : T$1 extends ((props: infer P, ...args: any) => any) ? P : {};
|
|
9
9
|
interface RenderResult<Props$1> extends LocatorSelectors {
|
|
@@ -1,13 +1,19 @@
|
|
|
1
|
-
import { page, utils } from "vitest/browser";
|
|
1
|
+
import { page, server, utils } from "vitest/browser";
|
|
2
2
|
import { config, mount } from "@vue/test-utils";
|
|
3
3
|
|
|
4
4
|
//#region src/pure.ts
|
|
5
5
|
const { debug, getElementLocatorSelectors } = utils;
|
|
6
6
|
const mountedWrappers = /* @__PURE__ */ new Set();
|
|
7
|
+
let idx = 0;
|
|
8
|
+
function ensureTestIdAttribute(element) {
|
|
9
|
+
const attributeId = server.config.browser.locators.testIdAttribute;
|
|
10
|
+
if (!element.hasAttribute(attributeId)) element.setAttribute(attributeId, `__vitest_${idx++}__`);
|
|
11
|
+
}
|
|
7
12
|
function render(Component, { container: customContainer, baseElement: customBaseElement,...mountOptions } = {}) {
|
|
8
|
-
const div = document.createElement("div");
|
|
9
13
|
const baseElement = customBaseElement || customContainer || document.body;
|
|
10
|
-
const container = customContainer || baseElement.appendChild(div);
|
|
14
|
+
const container = customContainer || baseElement.appendChild(document.createElement("div"));
|
|
15
|
+
ensureTestIdAttribute(baseElement);
|
|
16
|
+
ensureTestIdAttribute(container);
|
|
11
17
|
if (mountOptions.attachTo) throw new Error("`attachTo` is not supported, use `container` instead");
|
|
12
18
|
const wrapper = mount(Component, {
|
|
13
19
|
...mountOptions,
|
package/dist/pure.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as render, i as config, n as RenderResult, r as cleanup, t as ComponentRenderOptions } from "./pure-
|
|
1
|
+
import { a as render, i as config, n as RenderResult, r as cleanup, t as ComponentRenderOptions } from "./pure-CE5Uqrcq.js";
|
|
2
2
|
export { ComponentRenderOptions, RenderResult, cleanup, config, render };
|
package/dist/pure.js
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vitest-browser-vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.2",
|
|
5
5
|
"description": "Render Vue components in Vitest Browser Mode",
|
|
6
6
|
"author": "Vitest Community",
|
|
7
7
|
"license": "MIT",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@antfu/eslint-config": "^2.24.1",
|
|
51
51
|
"@vitejs/plugin-vue": "^6.0.1",
|
|
52
|
-
"@vitest/browser-playwright": "^4.0.
|
|
52
|
+
"@vitest/browser-playwright": "^4.0.18",
|
|
53
53
|
"bumpp": "^9.4.2",
|
|
54
54
|
"changelogithub": "^0.13.9",
|
|
55
55
|
"eslint": "^9.8.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"tsdown": "^0.15.9",
|
|
58
58
|
"tsx": "^4.16.5",
|
|
59
59
|
"typescript": "^5.5.4",
|
|
60
|
-
"vitest": "^4.0.
|
|
60
|
+
"vitest": "^4.0.18",
|
|
61
61
|
"vue": "^3.4.35",
|
|
62
62
|
"zx": "^8.1.4"
|
|
63
63
|
},
|