Skip to content

Commit db8f89a

Browse files
authored
fix(examples): correct 'test:projects' script to use vitest directly (#10683)
### Description Update the `test:projects` script in the `with-vitest` example to use Vitest's projects feature directly. ```diff # examples/with-vitest/package.json - "test:projects": "turbo run test", + "test:projects": "vitest run", ``` Currently, the `test:projects` script runs `turbo run test`, which leverages Turborepo's package-level caching. However, given the script name and the example's hybrid approach documentation, it seems more appropriate for this command to use `vitest run` directly to demonstrate Vitest's projects feature. Changes made: - Updated `package.json` to use `vitest run` for the `test:projects` script - Updated README.md to accurately describe what `test:projects` does - Updated the documentation in `docs/site/content/docs/guides/tools/vitest.mdx` to reflect the correct usage ### Testing Instructions 1. Clone the repository and navigate to the `examples/with-vitest` directory 2. Install dependencies: `pnpm install` 3. Build the shared config: `pnpm --filter @repo/vitest-config build` 4. Run the following commands to verify the fix: - `pnpm test` - Should run tests using Turborepo (with caching) - `pnpm test:projects` - Should run tests using Vitest's projects feature directly - `pnpm test:projects:watch` - Should run tests in watch mode using Vitest's projects feature 5. Verify that `test` and `test:projects` now have different behaviors as intended Co-authored-by: namidapoo <[email protected]>
1 parent 20bf97b commit db8f89a

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/site/content/docs/guides/tools/vitest.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,10 +342,10 @@ While your root `package.json` includes scripts for running tests globally:
342342
```json title="./package.json"
343343
{
344344
"scripts": {
345-
"test:projects": "turbo run test",
345+
"test:projects": "vitest run",
346346
"test:projects:watch": "vitest --watch"
347347
}
348348
}
349349
```
350350

351-
This configuration allows developers to run `pnpm test:projects:watch` at the root for a seamless local development experience using Vitest projects, while CI continues to use `turbo run test` to leverage package-level caching. **You'll still need to handle merged coverage reports manually as described in the previous section**.
351+
This configuration allows developers to run `pnpm test:projects` or `pnpm test:projects:watch` at the root for a seamless local development experience using Vitest projects, while CI continues to use `turbo run test` to leverage package-level caching. **You'll still need to handle merged coverage reports manually as described in the previous section**.

examples/with-vitest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pnpm build --filter=@repo/vitest-config
2424
## Available Commands
2525

2626
- `pnpm test`: Runs tests in each package using Turborepo (leverages caching)
27-
- `pnpm test:projects`: Same as above, explicitly named for the package-level approach
27+
- `pnpm test:projects`: Runs tests using Vitest's projects feature
2828
- `pnpm test:projects:watch`: Runs tests using Vitest's projects feature in watch mode
2929
- `pnpm view-report`: Collects coverage from each package and shows it in a merged report
3030

examples/with-vitest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"private": true,
44
"scripts": {
55
"test": "turbo run test",
6-
"test:projects": "turbo run test",
6+
"test:projects": "vitest run",
77
"test:projects:watch": "vitest --watch",
88
"view-report": "turbo run view-report"
99
},

0 commit comments

Comments
 (0)