twd-js 1.3.0-beta.2 โ 1.3.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 +32 -17
- package/dist/bundled.es.js +801 -46108
- package/dist/bundled.umd.js +2 -307
- package/dist/index.cjs.js +3 -3
- package/dist/index.es.js +1081 -1081
- package/dist/mock-sw.js +2 -2
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -36,27 +36,34 @@ pnpm add twd-js
|
|
|
36
36
|
|
|
37
37
|
## Quick Start
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
### React (Standard)
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
// src/main.tsx
|
|
43
|
-
import { StrictMode } from "react";
|
|
44
|
-
import { createRoot } from "react-dom/client";
|
|
45
|
-
import App from "./App";
|
|
41
|
+
Add this to your entry file (e.g., `src/main.tsx`):
|
|
46
42
|
|
|
43
|
+
```tsx
|
|
47
44
|
if (import.meta.env.DEV) {
|
|
48
45
|
const testModules = import.meta.glob("./**/*.twd.test.ts");
|
|
49
46
|
const { initTests, twd, TWDSidebar } = await import('twd-js');
|
|
50
47
|
initTests(testModules, <TWDSidebar open={true} position="left" />, createRoot);
|
|
51
48
|
twd.initRequestMocking().catch(console.error);
|
|
52
49
|
}
|
|
50
|
+
```
|
|
53
51
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
52
|
+
### Vue / Angular / Other Frameworks (Bundled)
|
|
53
|
+
|
|
54
|
+
TWD now supports any framework via its bundled version.
|
|
55
|
+
|
|
56
|
+
```ts
|
|
57
|
+
if (import.meta.env.DEV) {
|
|
58
|
+
const { initTWD } = await import('twd-js/bundled');
|
|
59
|
+
const tests = import.meta.glob("./**/*.twd.test.ts");
|
|
60
|
+
initTWD(tests);
|
|
61
|
+
}
|
|
57
62
|
```
|
|
58
63
|
|
|
59
|
-
|
|
64
|
+
Check the [Framework Integration Guide](https://brikev.github.io/twd/frameworks) for more details.
|
|
65
|
+
|
|
66
|
+
## Writing Tests
|
|
60
67
|
|
|
61
68
|
```ts
|
|
62
69
|
// src/app.twd.test.ts
|
|
@@ -131,17 +138,25 @@ twd.mockRequest("getUser", {
|
|
|
131
138
|
const rule = await twd.waitForRequest("getUser");
|
|
132
139
|
```
|
|
133
140
|
|
|
134
|
-
##
|
|
141
|
+
## Documentation
|
|
135
142
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
-
|
|
139
|
-
-
|
|
140
|
-
-
|
|
143
|
+
Full documentation is available at [twd.dev](https://twd.dev) (coming soon) or in the `docs` folder.
|
|
144
|
+
|
|
145
|
+
- [Getting Started](docs/getting-started.md)
|
|
146
|
+
- [Framework Integration](docs/frameworks.md)
|
|
147
|
+
- [Writing Tests](docs/writing-tests.md)
|
|
148
|
+
- [API Mocking](docs/api-mocking.md)
|
|
141
149
|
|
|
142
150
|
## Examples
|
|
143
151
|
|
|
144
|
-
Check out
|
|
152
|
+
Check out our working examples for various frameworks:
|
|
153
|
+
|
|
154
|
+
- **[Examples Directory](./examples)** - Local examples for React, Vue, and Astro
|
|
155
|
+
- **[Vue Example](https://github.com/BRIKEV/twd-vue-example)** - Vue 3 with advanced scenarios
|
|
156
|
+
- **[Solid Example](https://github.com/BRIKEV/twd-solid-example)** - Solid.js integration
|
|
157
|
+
- **[Angular Example](https://github.com/BRIKEV/twd-angular-example)** - Angular setup
|
|
158
|
+
|
|
159
|
+
Each example includes a complete setup guide and demonstrates best practices for testing with TWD including ci integration.
|
|
145
160
|
|
|
146
161
|
## Contributing
|
|
147
162
|
|