@@ -182,3 +182,49 @@ and will fail on slow connection or long response time:
182
182
dataType: ' script' ,
183
183
crossDomain: true
184
184
});
185
+
186
+
187
+ Raven Test Kit
188
+ --------------
189
+ When building tests for your application, you want to assert that the right flow-tracking or error is being sent to *Sentry *,
190
+ **but ** without really sending it to the *Sentry * system.
191
+ This way you won't swamp it with false reports during test running and other CI operations.
192
+
193
+ `Raven Test Kit <https://github.com/wix/raven-testkit >`_ enables Raven to work natively in your application,
194
+ but it overrides the default Raven transport mechanism so the report is not really sent but rather logged locally.
195
+ In this way, the logged reports can be fetched later for usage verification or other uses you may have in your testing environment.
196
+
197
+ Installation
198
+ ````````````
199
+ .. code-block :: sh
200
+
201
+ $ npm install raven-testkit --save-dev
202
+
203
+ How to Use
204
+ ``````````
205
+ Then you may create a ``testkit `` instance and validate your reports against it as follows:
206
+
207
+ .. code :: javascript
208
+
209
+ import testKitInitializer from ' raven-testkit'
210
+
211
+ const testKit = testKitInitializer (Raven)
212
+
213
+ // any scenario that should call Raven.catchException(...)
214
+
215
+ expect (testKit .reports ()).to .have .lengthOf (1 )
216
+ const report = testKit .reports ()[0 ]
217
+ expect (report).to .have .property (' release' ).to .equal (' test' )
218
+
219
+
220
+ Additionally, you may pass your own ``shouldSendCallback `` logic
221
+
222
+ .. code :: javascript
223
+
224
+ const shouldSendCallback = data => {
225
+ return /* your own logic */
226
+ }
227
+ const testKit = testKitInitializer (Raven, shouldSendCallback)
228
+
229
+
230
+ Other useful API, more example usage and updates can be found in `Raven Test Kit <https://github.com/wix/raven-testkit >`_
0 commit comments