twd-js 1.1.2 → 1.2.1
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 +20 -24
- package/dist/_commonjsHelpers-C6fGbg64.mjs +6 -0
- package/dist/_commonjsHelpers-DwGv2jUC.js +1 -0
- package/dist/index.cjs.js +39 -44
- package/dist/index.d.ts +433 -7
- package/dist/index.es.js +4670 -4917
- package/dist/jsx-runtime-CtyxV31n.mjs +276 -0
- package/dist/jsx-runtime-DN5DOl8k.js +6 -0
- package/dist/mock-sw.js +1 -1
- package/dist/runner-ci.cjs.js +1 -1
- package/dist/runner-ci.d.ts +28 -12
- package/dist/runner-ci.es.js +32 -22
- package/dist/runner.cjs.js +1 -1
- package/dist/runner.d.ts +55 -41
- package/dist/runner.es.js +127 -70
- package/dist/ui.cjs.js +1 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.es.js +11 -0
- package/dist/vite-plugin.d.ts +21 -1
- package/package.json +15 -10
- package/dist/asserts/index.d.ts +0 -2
- package/dist/commands/mockBridge.d.ts +0 -73
- package/dist/commands/url.d.ts +0 -33
- package/dist/commands/visit.d.ts +0 -1
- package/dist/constants/version.d.ts +0 -1
- package/dist/global.d.ts +0 -8
- package/dist/initializers/initSidebar.d.ts +0 -22
- package/dist/initializers/initTests.d.ts +0 -31
- package/dist/plugin/removeMockServiceWorker.d.ts +0 -18
- package/dist/proxies/domMessage.d.ts +0 -1
- package/dist/proxies/eventsMessage.d.ts +0 -1
- package/dist/proxies/screenDom.d.ts +0 -5
- package/dist/proxies/userEvent.d.ts +0 -4
- package/dist/twd-types.d.ts +0 -106
- package/dist/twd.d.ts +0 -178
- package/dist/ui/ClosedSidebar.d.ts +0 -6
- package/dist/ui/Icons/BaseIcon.d.ts +0 -7
- package/dist/ui/Icons/ChevronDown.d.ts +0 -2
- package/dist/ui/Icons/ChevronRight.d.ts +0 -2
- package/dist/ui/Icons/Loader.d.ts +0 -2
- package/dist/ui/Icons/MockRequestIcon.d.ts +0 -2
- package/dist/ui/Icons/Play.d.ts +0 -2
- package/dist/ui/MockRulesButton.d.ts +0 -1
- package/dist/ui/TWDSidebar.d.ts +0 -16
- package/dist/ui/TestList.d.ts +0 -17
- package/dist/ui/TestListItem.d.ts +0 -39
- package/dist/ui/buildTreeFromHandlers.d.ts +0 -14
- package/dist/ui/hooks/useLayout.d.ts +0 -6
- package/dist/utils/assertionMessage.d.ts +0 -1
- package/dist/utils/log.d.ts +0 -1
- package/dist/utils/wait.d.ts +0 -3
package/dist/runner.es.js
CHANGED
|
@@ -1,121 +1,178 @@
|
|
|
1
|
-
const r = /* @__PURE__ */ new Map(),
|
|
2
|
-
const
|
|
3
|
-
r.set(
|
|
4
|
-
id:
|
|
5
|
-
name:
|
|
1
|
+
const r = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), h = /* @__PURE__ */ new Map(), o = [], p = () => Math.random().toString(36).substr(2, 9), d = (s, t) => {
|
|
2
|
+
const e = p(), n = o.at(-1);
|
|
3
|
+
r.set(e, {
|
|
4
|
+
id: e,
|
|
5
|
+
name: s,
|
|
6
6
|
type: "suite",
|
|
7
7
|
children: [],
|
|
8
8
|
logs: [],
|
|
9
|
-
depth:
|
|
10
|
-
parent:
|
|
9
|
+
depth: o.length,
|
|
10
|
+
parent: n,
|
|
11
11
|
handler: t
|
|
12
|
-
}),
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
}), n && r.get(n).children.push(e), o.push(e), t(), o.pop();
|
|
13
|
+
};
|
|
14
|
+
d.only = (s, t) => {
|
|
15
|
+
const e = p(), n = o.at(-1);
|
|
16
|
+
r.set(e, {
|
|
17
|
+
id: e,
|
|
18
|
+
name: s,
|
|
19
|
+
type: "suite",
|
|
20
|
+
children: [],
|
|
21
|
+
logs: [],
|
|
22
|
+
depth: o.length,
|
|
23
|
+
parent: n,
|
|
24
|
+
handler: t,
|
|
25
|
+
only: !0
|
|
26
|
+
}), n && r.get(n).children.push(e), o.push(e), t(), o.pop();
|
|
27
|
+
};
|
|
28
|
+
d.skip = (s, t) => {
|
|
29
|
+
const e = p(), n = o.at(-1);
|
|
30
|
+
r.set(e, {
|
|
31
|
+
id: e,
|
|
32
|
+
name: s,
|
|
33
|
+
type: "suite",
|
|
34
|
+
children: [],
|
|
35
|
+
logs: [],
|
|
36
|
+
depth: o.length,
|
|
37
|
+
parent: n,
|
|
38
|
+
handler: t,
|
|
39
|
+
skip: !0
|
|
40
|
+
}), n && r.get(n).children.push(e), o.push(e), t(), o.pop();
|
|
41
|
+
};
|
|
42
|
+
const g = (s, t) => {
|
|
43
|
+
const e = p(), n = o.at(-1), i = {
|
|
44
|
+
id: e,
|
|
45
|
+
name: s,
|
|
17
46
|
type: "test",
|
|
18
|
-
depth:
|
|
47
|
+
depth: o.length,
|
|
19
48
|
handler: t,
|
|
20
49
|
logs: [],
|
|
21
|
-
parent:
|
|
50
|
+
parent: n
|
|
22
51
|
};
|
|
23
|
-
|
|
52
|
+
n && r.get(n).children.push(e), r.set(e, i);
|
|
24
53
|
};
|
|
25
|
-
|
|
26
|
-
const
|
|
27
|
-
id:
|
|
28
|
-
name:
|
|
54
|
+
g.only = (s, t) => {
|
|
55
|
+
const e = p(), n = o.at(-1), i = {
|
|
56
|
+
id: e,
|
|
57
|
+
name: s,
|
|
29
58
|
type: "test",
|
|
30
|
-
depth:
|
|
59
|
+
depth: o.length,
|
|
31
60
|
handler: t,
|
|
32
61
|
logs: [],
|
|
33
|
-
parent:
|
|
62
|
+
parent: n,
|
|
34
63
|
only: !0
|
|
35
64
|
};
|
|
36
|
-
|
|
65
|
+
n && r.get(n).children.push(e), r.set(e, i);
|
|
37
66
|
};
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
id:
|
|
41
|
-
name:
|
|
67
|
+
g.skip = (s, t) => {
|
|
68
|
+
const e = p(), n = o.at(-1), i = {
|
|
69
|
+
id: e,
|
|
70
|
+
name: s,
|
|
42
71
|
type: "test",
|
|
43
|
-
depth:
|
|
72
|
+
depth: o.length,
|
|
44
73
|
handler: t || (() => {
|
|
45
74
|
}),
|
|
46
75
|
logs: [],
|
|
47
|
-
parent:
|
|
76
|
+
parent: n,
|
|
48
77
|
skip: !0
|
|
49
78
|
};
|
|
50
|
-
|
|
79
|
+
n && r.get(n).children.push(e), r.set(e, i);
|
|
51
80
|
};
|
|
52
|
-
const
|
|
53
|
-
const t =
|
|
81
|
+
const w = (s) => {
|
|
82
|
+
const t = o.at(-1);
|
|
54
83
|
if (!t) throw new Error("beforeEach() must be inside a describe()");
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
const t =
|
|
84
|
+
a.has(t) || a.set(t, []), a.get(t).push(s);
|
|
85
|
+
}, b = (s) => {
|
|
86
|
+
const t = o.at(-1);
|
|
58
87
|
if (!t) throw new Error("afterEach() must be inside a describe()");
|
|
59
|
-
|
|
60
|
-
},
|
|
61
|
-
const t = [],
|
|
62
|
-
let
|
|
63
|
-
for (;
|
|
64
|
-
|
|
65
|
-
return { before: t, after:
|
|
66
|
-
},
|
|
67
|
-
|
|
88
|
+
h.has(t) || h.set(t, []), h.get(t).push(s);
|
|
89
|
+
}, y = (s) => {
|
|
90
|
+
const t = [], e = [];
|
|
91
|
+
let n = s;
|
|
92
|
+
for (; n; )
|
|
93
|
+
a.has(n) && t.unshift(...a.get(n)), h.has(n) && e.push(...h.get(n)), n = r.get(n)?.parent;
|
|
94
|
+
return { before: t, after: e };
|
|
95
|
+
}, u = (s) => {
|
|
96
|
+
const t = r.get(s);
|
|
97
|
+
return t ? t.only ? !0 : t.children ? t.children.some((e) => u(e)) : !1 : !1;
|
|
98
|
+
}, k = (s) => {
|
|
99
|
+
let t = r.get(s);
|
|
100
|
+
for (; t?.parent; ) {
|
|
101
|
+
const e = r.get(t.parent);
|
|
102
|
+
if (e?.only) return !0;
|
|
103
|
+
t = e;
|
|
104
|
+
}
|
|
105
|
+
return !1;
|
|
106
|
+
}, f = (s) => {
|
|
107
|
+
let t = r.get(s);
|
|
108
|
+
for (; t; ) {
|
|
109
|
+
if (t.skip) return !0;
|
|
110
|
+
if (!t.parent) break;
|
|
111
|
+
t = r.get(t.parent);
|
|
112
|
+
}
|
|
113
|
+
return !1;
|
|
114
|
+
}, v = () => {
|
|
115
|
+
r.clear(), a.clear(), h.clear();
|
|
68
116
|
};
|
|
69
|
-
class
|
|
117
|
+
class S {
|
|
70
118
|
events;
|
|
71
119
|
constructor(t) {
|
|
72
120
|
this.events = t;
|
|
73
121
|
}
|
|
74
122
|
async runAll() {
|
|
75
123
|
const t = Array.from(r.values()).filter(
|
|
76
|
-
(
|
|
77
|
-
),
|
|
78
|
-
for (const
|
|
79
|
-
await this.runSuite(
|
|
124
|
+
(n) => !n.parent && n.type === "suite"
|
|
125
|
+
), e = Array.from(r.values()).some((n) => n.only);
|
|
126
|
+
for (const n of t)
|
|
127
|
+
await this.runSuite(n, e);
|
|
80
128
|
return r;
|
|
81
129
|
}
|
|
82
130
|
async runSingle(t) {
|
|
83
|
-
const
|
|
84
|
-
if (!
|
|
85
|
-
await this.runTest(
|
|
131
|
+
const e = r.get(t);
|
|
132
|
+
if (!e || e.type !== "test") return;
|
|
133
|
+
await this.runTest(e, !1);
|
|
86
134
|
}
|
|
87
|
-
async runSuite(t,
|
|
135
|
+
async runSuite(t, e) {
|
|
136
|
+
if (f(t.id) && !u(t.id)) {
|
|
137
|
+
this.events.onSkip?.(t);
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
140
|
+
if (e && !u(t.id)) return;
|
|
88
141
|
this.events.onSuiteStart?.(t);
|
|
89
|
-
const
|
|
90
|
-
for (const
|
|
91
|
-
|
|
142
|
+
const i = (t.children || []).map((c) => r.get(c));
|
|
143
|
+
for (const c of i)
|
|
144
|
+
c.type === "suite" ? await this.runSuite(c, e) : c.type === "test" && await this.runTest(c, e);
|
|
92
145
|
this.events.onSuiteEnd?.(t);
|
|
93
146
|
}
|
|
94
|
-
async runTest(t,
|
|
95
|
-
if (t.skip) {
|
|
147
|
+
async runTest(t, e) {
|
|
148
|
+
if ((f(t.id) || t.skip) && !t.only) {
|
|
149
|
+
this.events.onSkip(t);
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
const i = k(t.id);
|
|
153
|
+
if (e && !t.only && !i) {
|
|
96
154
|
this.events.onSkip(t);
|
|
97
155
|
return;
|
|
98
156
|
}
|
|
99
|
-
if (s && !t.only) return;
|
|
100
157
|
this.events.onStart?.(t);
|
|
101
|
-
const
|
|
158
|
+
const c = y(t.parent);
|
|
102
159
|
try {
|
|
103
|
-
for (const
|
|
160
|
+
for (const l of c.before) await l();
|
|
104
161
|
t.logs = [], await t.handler(), this.events.onPass(t);
|
|
105
|
-
} catch (
|
|
106
|
-
this.events.onFail(t,
|
|
162
|
+
} catch (l) {
|
|
163
|
+
this.events.onFail(t, l);
|
|
107
164
|
} finally {
|
|
108
|
-
for (const
|
|
165
|
+
for (const l of c.after) await l();
|
|
109
166
|
}
|
|
110
167
|
}
|
|
111
168
|
}
|
|
112
|
-
window.__testRunner =
|
|
169
|
+
window.__testRunner = S;
|
|
113
170
|
export {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
171
|
+
S as TestRunner,
|
|
172
|
+
b as afterEach,
|
|
173
|
+
w as beforeEach,
|
|
174
|
+
v as clearTests,
|
|
175
|
+
d as describe,
|
|
119
176
|
r as handlers,
|
|
120
|
-
|
|
177
|
+
g as it
|
|
121
178
|
};
|
package/dist/ui.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./jsx-runtime-DN5DOl8k.js");function r({name:n,children:o}){const e=t.getMockForComponent(n);return e?t.jsxRuntimeExports.jsx(e,{...o.props}):o}exports.MockedComponent=r;
|
package/dist/ui.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { JSX } from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
export declare function MockedComponent<TProps extends Record<string, any>>({ name, children, }: MockedComponentProps<TProps>): JSX.Element;
|
|
4
|
+
|
|
5
|
+
declare interface MockedComponentProps<TProps = any> {
|
|
6
|
+
name: string;
|
|
7
|
+
children: React.ReactElement<TProps>;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export { }
|
package/dist/ui.es.js
ADDED
package/dist/vite-plugin.d.ts
CHANGED
|
@@ -1 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
import { Plugin as Plugin_2 } from 'vite';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Vite plugin to remove the mock service worker file from the build output.
|
|
5
|
+
* This is useful for production builds where you don't want the mock service worker to be included.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* import { removeMockServiceWorker } from 'twd-js';
|
|
10
|
+
*
|
|
11
|
+
* export default defineConfig({
|
|
12
|
+
* plugins: [
|
|
13
|
+
* // ... other plugins
|
|
14
|
+
* removeMockServiceWorker()
|
|
15
|
+
* ]
|
|
16
|
+
* });
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function removeMockServiceWorker(): Plugin_2;
|
|
20
|
+
|
|
21
|
+
export { }
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "twd-js",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "Test While Developing (TWD) - in-browser testing",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "BRIKEV",
|
|
@@ -38,6 +38,11 @@
|
|
|
38
38
|
"types": "./dist/runner-ci.d.ts",
|
|
39
39
|
"import": "./dist/runner-ci.es.js",
|
|
40
40
|
"require": "./dist/runner-ci.cjs.js"
|
|
41
|
+
},
|
|
42
|
+
"./ui": {
|
|
43
|
+
"types": "./dist/ui.d.ts",
|
|
44
|
+
"import": "./dist/ui.es.js",
|
|
45
|
+
"require": "./dist/ui.cjs.js"
|
|
41
46
|
}
|
|
42
47
|
},
|
|
43
48
|
"files": [
|
|
@@ -65,18 +70,17 @@
|
|
|
65
70
|
"devDependencies": {
|
|
66
71
|
"@testing-library/jest-dom": "^6.9.1",
|
|
67
72
|
"@testing-library/react": "^16.3.0",
|
|
68
|
-
"@types/
|
|
69
|
-
"@types/react": "^19.2.3",
|
|
70
|
-
"@
|
|
71
|
-
"@
|
|
72
|
-
"@vitest/coverage-v8": "^4.0.8",
|
|
73
|
+
"@types/react": "^19.2.6",
|
|
74
|
+
"@types/react-dom": "^19.2.3",
|
|
75
|
+
"@vitejs/plugin-react": "^5.1.1",
|
|
76
|
+
"@vitest/coverage-v8": "^4.0.13",
|
|
73
77
|
"conventional-changelog": "^7.1.1",
|
|
74
|
-
"jsdom": "^27.
|
|
78
|
+
"jsdom": "^27.2.0",
|
|
75
79
|
"typescript": "^5.9.3",
|
|
76
|
-
"vite": "^7.2.
|
|
80
|
+
"vite": "^7.2.4",
|
|
77
81
|
"vite-plugin-dts": "^4.5.4",
|
|
78
82
|
"vitepress": "^2.0.0-alpha.12",
|
|
79
|
-
"vitest": "^4.0.
|
|
83
|
+
"vitest": "^4.0.13"
|
|
80
84
|
},
|
|
81
85
|
"keywords": [
|
|
82
86
|
"testing",
|
|
@@ -91,7 +95,8 @@
|
|
|
91
95
|
"dependencies": {
|
|
92
96
|
"@testing-library/dom": "^10.4.1",
|
|
93
97
|
"@testing-library/user-event": "^14.6.1",
|
|
98
|
+
"@types/chai": "^5.2.3",
|
|
94
99
|
"chai": "^6.2.1",
|
|
95
|
-
"
|
|
100
|
+
"picocolors": "^1.1.1"
|
|
96
101
|
}
|
|
97
102
|
}
|
package/dist/asserts/index.d.ts
DELETED
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
export type Rule = {
|
|
2
|
-
method: string;
|
|
3
|
-
url: string | RegExp;
|
|
4
|
-
response: unknown;
|
|
5
|
-
alias: string;
|
|
6
|
-
executed?: boolean;
|
|
7
|
-
request?: any;
|
|
8
|
-
status?: number;
|
|
9
|
-
responseHeaders?: Record<string, string>;
|
|
10
|
-
urlRegex?: boolean;
|
|
11
|
-
};
|
|
12
|
-
export interface Options {
|
|
13
|
-
method: string;
|
|
14
|
-
url: string | RegExp;
|
|
15
|
-
response: unknown;
|
|
16
|
-
status?: number;
|
|
17
|
-
responseHeaders?: Record<string, string>;
|
|
18
|
-
urlRegex?: boolean;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Initialize the mocking service worker.
|
|
22
|
-
* Call this once before using `mockRequest` or `waitFor`.
|
|
23
|
-
*/
|
|
24
|
-
export declare const initRequestMocking: () => Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Mock a network request.
|
|
27
|
-
*
|
|
28
|
-
* @param alias Identifier for the mock rule. Useful for `waitFor()`.
|
|
29
|
-
* @param options Options to configure the mock:
|
|
30
|
-
* - `method`: HTTP method ("GET", "POST", …)
|
|
31
|
-
* - `url`: URL string or RegExp to match
|
|
32
|
-
* - `response`: Body of the mocked response
|
|
33
|
-
* - `status`: (optional) HTTP status code (default: 200)
|
|
34
|
-
* - `responseHeaders`: (optional) Response headers
|
|
35
|
-
* - `urlRegex`: (optional) Whether the URL is a regex (default: false)
|
|
36
|
-
*
|
|
37
|
-
* @example
|
|
38
|
-
* ```ts
|
|
39
|
-
* mockRequest("getUser", {
|
|
40
|
-
* method: "GET",
|
|
41
|
-
* url: /\/api\/user\/\d+/,
|
|
42
|
-
* response: { id: 1, name: "Kevin" },
|
|
43
|
-
* status: 200,
|
|
44
|
-
* headers: { "x-mock": "true" }
|
|
45
|
-
* });
|
|
46
|
-
* ```
|
|
47
|
-
*/
|
|
48
|
-
export declare const mockRequest: (alias: string, options: Options) => Promise<void>;
|
|
49
|
-
/**
|
|
50
|
-
* wait for a list of mocked requests to be made.
|
|
51
|
-
* @param aliases The aliases of the mock rules to wait for
|
|
52
|
-
* @returns The matched rules (with body if applicable)
|
|
53
|
-
* @example
|
|
54
|
-
* ```ts
|
|
55
|
-
* await waitForRequests(["getUser", "postComment"]);
|
|
56
|
-
* ```
|
|
57
|
-
*/
|
|
58
|
-
export declare const waitForRequests: (aliases: string[]) => Promise<Rule[]>;
|
|
59
|
-
/**
|
|
60
|
-
* Wait for a mocked request to be made.
|
|
61
|
-
* @param alias The alias of the mock rule to wait for
|
|
62
|
-
* @returns The matched rule (with body if applicable)
|
|
63
|
-
*/
|
|
64
|
-
export declare const waitForRequest: (alias: string) => Promise<Rule>;
|
|
65
|
-
/**
|
|
66
|
-
* Get the current list of request mock rules.
|
|
67
|
-
* @returns The current list of request mock rules.
|
|
68
|
-
*/
|
|
69
|
-
export declare const getRequestMockRules: () => Rule[];
|
|
70
|
-
/**
|
|
71
|
-
* Clear all request mock rules.
|
|
72
|
-
*/
|
|
73
|
-
export declare const clearRequestMockRules: () => void;
|
package/dist/commands/url.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* All supported assertion names for the `should` function in url command
|
|
3
|
-
*
|
|
4
|
-
* @example
|
|
5
|
-
* twd.url().should("contain.url", "/new-page");
|
|
6
|
-
* twd.url().should("eq", "http://localhost:3000/new-page");
|
|
7
|
-
*/
|
|
8
|
-
export type URLAssertionName = "eq" | "contain.url";
|
|
9
|
-
/**
|
|
10
|
-
* Negatable assertion names (e.g., 'not.have.text').
|
|
11
|
-
*/
|
|
12
|
-
export type Negatable<T extends string> = T | `not.${T}`;
|
|
13
|
-
/**
|
|
14
|
-
* All assertion names, including negated ones.
|
|
15
|
-
*/
|
|
16
|
-
export type AnyURLAssertion = Negatable<URLAssertionName>;
|
|
17
|
-
export type URLCommandAPI = {
|
|
18
|
-
location: Location;
|
|
19
|
-
should: (name: AnyURLAssertion, value: string) => URLCommandAPI | string;
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Argument types for each assertion.
|
|
23
|
-
*/
|
|
24
|
-
export type URLAssertionArgs = {
|
|
25
|
-
(name: "contain.url", urlPart: string): URLCommandAPI;
|
|
26
|
-
(name: "not.contain.url", urlPart: string): URLCommandAPI;
|
|
27
|
-
};
|
|
28
|
-
/**
|
|
29
|
-
* URL command for assertions on the current URL.
|
|
30
|
-
* @returns URLCommandAPI
|
|
31
|
-
*/
|
|
32
|
-
declare const urlCommand: () => URLCommandAPI;
|
|
33
|
-
export default urlCommand;
|
package/dist/commands/visit.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const visit: (url: string, reload?: boolean) => Promise<void>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const TWD_VERSION = "1.1.2";
|
package/dist/global.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
interface Options {
|
|
2
|
-
Component: React.ReactNode;
|
|
3
|
-
createRoot: (el: HTMLElement) => {
|
|
4
|
-
render: (el: React.ReactNode) => void;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Initialize the TWD sidebar.
|
|
9
|
-
* @param options - Options for initializing the sidebar.
|
|
10
|
-
* @example
|
|
11
|
-
* ```ts
|
|
12
|
-
* import { initSidebar } from 'twd-js';
|
|
13
|
-
*
|
|
14
|
-
* // Initialize the sidebar (e.g., in your main app file)
|
|
15
|
-
* initSidebar({
|
|
16
|
-
* Component: <TWDSidebar open={true} position="left" />,
|
|
17
|
-
* createRoot,
|
|
18
|
-
* });
|
|
19
|
-
* ```
|
|
20
|
-
*/
|
|
21
|
-
export declare const initSidebar: (options: Options) => void;
|
|
22
|
-
export {};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* A record of test module paths to their loader functions.
|
|
3
|
-
* Each function returns a promise that resolves when the module is loaded.
|
|
4
|
-
* This is typically used with Vite's `import.meta.glob` to dynamically import test modules.
|
|
5
|
-
* @example
|
|
6
|
-
* ```ts
|
|
7
|
-
* const testModules = {
|
|
8
|
-
* './test1.twd.test.ts': () => import('./test1.twd.test.ts'),
|
|
9
|
-
* './test2.twd.test.ts': () => import('./test2.twd.test.ts'),
|
|
10
|
-
* };
|
|
11
|
-
* ```
|
|
12
|
-
*/
|
|
13
|
-
type TestModule = Record<string, () => Promise<unknown>>;
|
|
14
|
-
/**
|
|
15
|
-
* Initialize Vite test loading.
|
|
16
|
-
* @param testModules - The test modules to load.
|
|
17
|
-
* @param component - The React component to render the sidebar.
|
|
18
|
-
* @param createRoot - Function to create a React root.
|
|
19
|
-
* @example
|
|
20
|
-
* ```ts
|
|
21
|
-
* if (import.meta.env.DEV) {
|
|
22
|
-
* const testModules = import.meta.glob("./example.twd.test.ts");
|
|
23
|
-
* const { initTests, TWDSidebar } = await import('twd-js');
|
|
24
|
-
* await initTests(testModules, <TWDSidebar open={true} position="left" />, createRoot);
|
|
25
|
-
* }
|
|
26
|
-
* ```
|
|
27
|
-
*/
|
|
28
|
-
export declare const initTests: (testModules: TestModule, Component: React.ReactNode, createRoot: (el: HTMLElement) => {
|
|
29
|
-
render: (el: React.ReactNode) => void;
|
|
30
|
-
}) => Promise<void>;
|
|
31
|
-
export {};
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { Plugin } from 'vite';
|
|
2
|
-
/**
|
|
3
|
-
* Vite plugin to remove the mock service worker file from the build output.
|
|
4
|
-
* This is useful for production builds where you don't want the mock service worker to be included.
|
|
5
|
-
*
|
|
6
|
-
* @example
|
|
7
|
-
* ```ts
|
|
8
|
-
* import { removeMockServiceWorker } from 'twd-js';
|
|
9
|
-
*
|
|
10
|
-
* export default defineConfig({
|
|
11
|
-
* plugins: [
|
|
12
|
-
* // ... other plugins
|
|
13
|
-
* removeMockServiceWorker()
|
|
14
|
-
* ]
|
|
15
|
-
* });
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
|
-
export declare function removeMockServiceWorker(): Plugin;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function domMessage(prefix: string, prop: PropertyKey, args: any[]): string;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function eventsMessage(prefix: string, prop: PropertyKey, args: any[]): string;
|