Skip to content

Commit

Permalink
docs: adding browser only support documentation
Browse files Browse the repository at this point in the history
#resolves #173
  • Loading branch information
zivl committed Sep 23, 2023
1 parent 6fb49e3 commit 9d5377b
Show file tree
Hide file tree
Showing 3 changed files with 141 additions and 148 deletions.
33 changes: 33 additions & 0 deletions website/docs/browser-only.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
title: Browser Only
description: Browser only support for sentry-testkit
sidebar_position: 5
---

# Running in Browser Only Mode

`Sentry-testkit` is a JavaScript library commonly used with the Sentry error monitoring and reporting platform. It offers the ability to simulate and test Sentry error reporting. A noteworthy aspect of `sentry-testkit` is its compatibility with different JavaScript environments, including both Node.js and web browsers. This compatibility is achieved through the following mechanisms:

## Node.js Dependencies

`Sentry-testkit` relies on two Node.js packages, namely `express` and `http`. These packages are typically used in Node.js applications for tasks such as handling HTTP requests and creating web servers. This dependency implies that `sentry-testkit` was originally designed with Node.js environments in mind, where server-side JavaScript operations are common.

## Separated Browser-Only Entry Point

To make `sentry-testkit` suitable for use in web browsers (client-side JavaScript), a separate entry point called `sentry-testkit/browser` has been introduced. This browser-specific entry point is configured to exclude any code that depends on Node.js-specific features or APIs.

This separation ensures that when using `sentry-testkit` in a browser context, you won't encounter issues related to Node.js-specific code that wouldn't work in browsers. Instead, you can rely on the `sentry-testkit/browser` version to provide compatibility with browser-based JavaScript applications.

In summary, `sentry-testkit` offers versatility by supporting both Node.js and browser environments. The introduction of `sentry-testkit/browser` allows developers to seamlessly use this library for testing Sentry error reporting in a variety of JavaScript environments.

### Usage
```javascript
import sentryTestkit from 'sentry-testkit/browser';

const { sentryTransport, testkit } = sentryTestkit();

// initialize your Sentry instance with sentryTransport

// ...the rest of the testkit usage is the same as in the Node.js example

```
2 changes: 1 addition & 1 deletion website/docs/raven-testkit-legacy.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Raven Testkit
title: Raven Testkit (Legacy API)
description: The legacy API reference of raven testkit.
sidebar_position: 10
---
Expand Down
Loading

0 comments on commit 9d5377b

Please sign in to comment.