Skip to content

Commit 04b58a5

Browse files
authored
docs(readme): document how to run tests using Nx (#8967)
1 parent 667650a commit 04b58a5

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

CONTRIBUTING.md

+33
Original file line numberDiff line numberDiff line change
@@ -236,3 +236,36 @@ Use an appropriate commit type. Be especially careful with breaking changes.
236236
## Releases
237237

238238
For each new commit added to `main` with `git push` or by merging a pull request or merging from another branch, a GitHub action is triggered and runs the `semantic-release` command to make a release if there are codebase changes since the last release that affect the package functionalities.
239+
240+
## 🧪 Test
241+
242+
TanStack Query uses [Nx](https://nx.dev/) as its monorepo tool.
243+
To run tests in a local environment, you should use `nx` commands from the root directory.
244+
245+
### ✅ Run all tests
246+
247+
To run tests for **all packages**, run:
248+
249+
```bash
250+
npm run test
251+
```
252+
253+
### ✅ Run tests for a specific package
254+
255+
To run tests for a specific package, use the following command:
256+
257+
```bash
258+
npx nx run @tanstack/{package-name}:test:lib
259+
```
260+
261+
For example:
262+
263+
```bash
264+
npx nx run @tanstack/react-query:test:lib
265+
```
266+
267+
### ⚠️ Caution
268+
269+
Do not run `pnpm run test:lib` inside individual package folders.
270+
This can cause test failures due to dependencies between packages.
271+
Always run tests from the **root folder** using `nx` commands.

0 commit comments

Comments
 (0)