Skip to content

docs(readme): document how to run tests using Nx #8967

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,36 @@ Use an appropriate commit type. Be especially careful with breaking changes.
## Releases

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.

## 🧪 Test

TanStack Query uses [Nx](https://nx.dev/) as its monorepo tool.
To run tests in a local environment, you should use `nx` commands from the root directory.

### ✅ Run all tests

To run tests for **all packages**, run:

```bash
npm run test
```

### ✅ Run tests for a specific package

To run tests for a specific package, use the following command:

```bash
npx nx run @tanstack/{package-name}:test:lib
```

For example:

```bash
npx nx run @tanstack/react-query:test:lib
```

### ⚠️ Caution

Do not run `pnpm run test:lib` inside individual package folders.
This can cause test failures due to dependencies between packages.
Always run tests from the **root folder** using `nx` commands.
Loading