You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/platforms/javascript/common/configuration/sentry-testkit/index.mdx
+14-9Lines changed: 14 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,7 @@ description: "Learn how to assert that the right flow-tracking or error is being
6
6
7
7
When building tests for your application, you want to assert that the right flow-tracking or error is being sent to Sentry, but without really sending it to the Sentry servers. This way you won't swamp Sentry with false reports during test runs or other CI operations.
8
8
9
-
Note: [Wix](https://wix.github.io/sentry-testkit/), a Sentry partner, maintains Sentry Testkit.
10
-
11
-
[Sentry Testkit](https://wix.github.io/sentry-testkit/) is a Sentry plugin that allows intercepting Sentry's reports and further inspection of the data being sent. It enables Sentry to work natively in your application, and by overriding the default Sentry's transport mechanism, the report is not really sent, but rather logged locally into the memory. This way, logged reports can be fetched later for your own usage, verification, or any other use you may have in your local developing/testing environment.
9
+
[Sentry Testkit](https://zivl.github.io/sentry-testkit/) is a Sentry plugin that allows Sentry's reports to be intercepted for further data inspection. It enables Sentry to work natively in your application, by overriding Sentry's default transport mechanism, which makes it so that the report isn't really sent, but rather logged locally into memory. This way, logged reports can be fetched later for your own usage, verification, or any other purpose you may have in your local developing or testing environment.
12
10
13
11
## Installation
14
12
@@ -30,16 +28,23 @@ Sentry.init({
30
28
//... other configurations
31
29
});
32
30
33
-
// then run any scenario that should call Sentry.catchException(...)
31
+
test('collect error events', function () {
32
+
// run any scenario that eventually calls Sentry.captureException(...)
33
+
expect(testkit.reports()).toHaveLength(1);
34
+
constreport=testkit.reports()[0];
35
+
expect(report).toHaveProperty(/*...*/);
36
+
});
34
37
35
-
expect(testkit.reports()).toHaveLength(1);
36
-
constreport=testkit.reports()[0];
37
-
expect(report).toHaveProperty(/*...*/);
38
+
// Similarly for performance events
39
+
test('collect performance events', function () {
40
+
// run any scenario that eventually calls Sentry.startTransaction(...)
41
+
expect(testkit.transactions()).toHaveLength(1);
42
+
});
38
43
```
39
44
40
-
You may see more usage examples in the [testing section](https://github.com/wix/sentry-testkit/tree/master/test) of sentry-testkit repository as well.
45
+
You may see more usage examples in the [testing section](https://github.com/zivl/sentry-testkit/tree/master/test) of sentry-testkit repository as well.
41
46
42
47
### Testkit API
43
48
44
49
Sentry Testkit consists of a very simple and straightforward API.
45
-
See the full API description and documentation in [Sentry Testkit Docs](https://wix.github.io/sentry-testkit/).
50
+
See the full API description and documentation in [Sentry Testkit Docs](https://zivl.github.io/sentry-testkit/docs/api).
0 commit comments