wrapito 13.3.1-beta7 → 13.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 +28 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -84,6 +84,34 @@ Add this line in your project setup (vite/cra):
|
|
|
84
84
|
setupFiles: ['./src/setupTests.tsx']
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
+
#### warnOnPendingRequests
|
|
88
|
+
|
|
89
|
+
When rendering a full application, some API calls may still be pending when the test finishes. This can lead to flaky
|
|
90
|
+
tests if those pending requests resolve after the test cleanup phase.
|
|
91
|
+
|
|
92
|
+
By enabling `warnOnPendingRequests`, wrapito will log a warning to the console whenever a fetch call is detected after
|
|
93
|
+
a test has finished, including the request URL, method and the name of the test that left it pending. This helps
|
|
94
|
+
identify tests that need proper cleanup or `await` handling.
|
|
95
|
+
|
|
96
|
+
```js
|
|
97
|
+
import { configure } from 'wrapito'
|
|
98
|
+
|
|
99
|
+
configure({
|
|
100
|
+
...configuration,
|
|
101
|
+
warnOnPendingRequests: true,
|
|
102
|
+
})
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
When a pending request is detected, you will see a warning like:
|
|
106
|
+
|
|
107
|
+
```
|
|
108
|
+
🌯 wrapito
|
|
109
|
+
⚠️ pending request detected after test finished:
|
|
110
|
+
URL: https://my-host/api/products/
|
|
111
|
+
METHOD: get
|
|
112
|
+
TEST: should render the product list
|
|
113
|
+
```
|
|
114
|
+
|
|
87
115
|
## 🏰 Builder API
|
|
88
116
|
|
|
89
117
|
#### withMocks (Deprecated)
|