twd-js 0.5.2 → 0.7.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 +19 -0
- package/dist/global.d.ts +8 -0
- package/dist/index.cjs.js +320 -0
- package/dist/index.d.ts +1 -1
- package/dist/{twd.es.js → index.es.js} +3838 -3808
- package/dist/mock-sw.js +1 -1
- package/dist/plugin/removeMockServiceWorker.d.ts +18 -0
- package/dist/runner-ci.cjs.js +5 -0
- package/dist/runner-ci.d.ts +12 -0
- package/dist/runner-ci.es.js +304 -0
- package/dist/runner.cjs.js +1 -0
- package/dist/runner.d.ts +41 -0
- package/dist/runner.es.js +121 -0
- package/dist/twd.d.ts +13 -34
- package/dist/ui/TestList.d.ts +14 -4
- package/dist/ui/TestListItem.d.ts +16 -6
- package/dist/ui/buildTreeFromHandlers.d.ts +14 -0
- package/dist/ui/hooks/useLayout.d.ts +6 -0
- package/dist/vite-plugin.cjs.js +1 -0
- package/dist/vite-plugin.d.ts +1 -0
- package/dist/vite-plugin.es.js +18 -0
- package/package.json +21 -3
- package/dist/twd.umd.js +0 -320
- package/dist/twdRegistry.d.ts +0 -18
- package/dist/ui/groupTests.d.ts +0 -7
package/README.md
CHANGED
|
@@ -289,6 +289,25 @@ npx twd-js init <public-dir> [--save]
|
|
|
289
289
|
|
|
290
290
|
This will copy `mock-sw.js` to your public directory.
|
|
291
291
|
|
|
292
|
+
**Removing the Service Worker in Production Builds**
|
|
293
|
+
|
|
294
|
+
The service worker file (`mock-sw.js`) is only needed during development for API mocking. To remove it from production builds, use the `removeMockServiceWorker` Vite plugin:
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
// vite.config.ts
|
|
298
|
+
import { defineConfig } from 'vite';
|
|
299
|
+
import { removeMockServiceWorker } from 'twd-js';
|
|
300
|
+
|
|
301
|
+
export default defineConfig({
|
|
302
|
+
plugins: [
|
|
303
|
+
// ... other plugins
|
|
304
|
+
removeMockServiceWorker()
|
|
305
|
+
]
|
|
306
|
+
});
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
This plugin will automatically remove `mock-sw.js` from your build output during production builds.
|
|
310
|
+
|
|
292
311
|
### Mock Requests
|
|
293
312
|
|
|
294
313
|
Use `twd.mockRequest()` to define API mocks in your tests:
|