Skip to content

Commit

Permalink
Merge pull request #74 from nikolalsvk/update-readme
Browse files Browse the repository at this point in the history
Add section about testing in Vitest
  • Loading branch information
nikolalsvk authored Oct 21, 2023
2 parents c12a825 + dbba73c commit 0cb9d91
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ npm install -D pusher-js-mock
- [Mocking presence channels](#mocking-presence-channels)
- [Using custom authorizer](#using-custom-authorizer)
- [Pusher events emitted by presence channels](#pusher-events-emitted-by-presence-channels)
- [Using with Vitest](#using-with-vitest)

For more detailed examples, check out [`examples` directory](https://github.com/nikolalsvk/pusher-js-mock/tree/master/examples)
inside the project!
Expand Down Expand Up @@ -296,6 +297,19 @@ it("should emit presence-channel events", async () => {
});
```

### Using with Vitest

You can mock Pusher.js in Vitest environment like this:

```js
vi.mock("pusher-js", () => {
return {
__esModule: true,
default: require("pusher-js-mock").PusherMock,
};
});
```

### [Code of Conduct](CODE_OF_CODUCT.md)

### [Contributing](CONTRIBUTING.md)
Expand Down

0 comments on commit 0cb9d91

Please sign in to comment.