Skip to content

Commit

Permalink
Update testing docs (#2098)
Browse files Browse the repository at this point in the history
* Update testing docs

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Minor changes

* Update docs/guides/testing.md

Co-authored-by: Blazej Sewera <[email protected]>

---------

Co-authored-by: Blazej Sewera <[email protected]>
  • Loading branch information
dbritto-dev and sewera committed Oct 4, 2023
1 parent ec538e9 commit 2be79c9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion docs/guides/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ this means your application logic does not need to be changed or mocked when wri
The mock provided below will enable the relevant test runner to reset the zustand stores after each test.

> **Warning:** In the following examples we are only supporting the curried version of create `(create()(...))`,
> since it is supported on both JavaScript and TypeScript. If you are using the uncurried version of
> `create(...)` you will need to update your hooks to use the curried version, or update the mocks in order
> to support the uncurried version.
### Jest

In the next steps we are going to setup our Jest environment in order to mock Zustand.
Expand Down Expand Up @@ -130,7 +135,13 @@ export default config
### Vitest

In the next steps we are going to setup our Vitest environment in order to mock Zustand
In the next steps we are going to setup our Vitest environment in order to mock Zustand.

> **Warning:** In Vitest you can change the [root](https://vitest.dev/config/#root).
> Due to that, you need make sure that you are creating your `__mocks__` directory in the right place.
> Let's say that you change the **root** to `./src`, that means you need to create a `__mocks__`
> directory under `./src`. The end result would be `./src/__mocks__`, rather than `./__mocks__`.
> Creating `__mocks__` directory in the wrong place can lead to issues when using Vitest.
```ts
// __mocks__/zustand.ts
Expand Down

1 comment on commit 2be79c9

@vercel
Copy link

@vercel vercel bot commented on 2be79c9 Oct 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.