Repository navigation
chore: consolidate vitest execution - #29039
dulmandakh wants to merge 9 commits into
Conversation
WalkthroughConsolidates per-package tests into a centralized Vitest setup: adds root and package Vitest configs, removes many package-level Changes
Sequence Diagram(s)sequenceDiagram
participant GH as "GitHub Actions"
participant Runner as "Runner (no-docker)"
participant Node as "Node / pnpm"
participant Vitest as "Vitest"
participant Packages as "Monorepo Packages"
GH->>Runner: trigger job vitest-unit-tests (matrix)
Runner->>Node: checkout & setup Node, pnpm install
Runner->>Node: run `pnpm vitest run`
Node->>Vitest: start multi-project discovery (vitest.config.ts)
Vitest->>Packages: discover & run tests across packages (exclusions applied)
Packages-->>Vitest: test results
Vitest-->>Node: aggregated results
Node-->>Runner: exit status
Runner-->>GH: job result
Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 6
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/test-template.yml (1)
904-927: Make the Vitest config explicit in CI.With multiple per-package configs, relying on auto-discovery can be fragile. Consider passing
--config vitest.config.tsso this job always uses the root workspace definition; please verify the flag is supported in Vitest 3.2.4.🔧 Suggested change
- - run: pnpm vitest run + - run: pnpm vitest run --config vitest.config.ts
🤖 Fix all issues with AI agents
In @.github/workflows/test-template.yml:
- Around line 1094-1097: The Vitest Unit Tests step is missing the explicit
config flag used by the main Vitest job; update the step that runs "pnpm vitest
run" (job name "Vitest Unit Tests") to include the same explicit Vitest config
flag (for example --config=vitest.config.ts) so macOS/Windows use the identical
project set, and verify that the chosen flag is supported by Vitest 3.2.4 before
committing.
In `@packages/client-common/vitest.config.ts`:
- Around line 1-7: Add a brief doc comment above the exported Vitest
configuration (the export default defineConfig({...}) block) explaining that
this is the package-specific Vitest config and why 'dist/*' is excluded (to
avoid running tests against built artifacts/compiled output). Place the comment
immediately above the export so it documents the exported config, referencing
the test.exclude setting that appends 'dist/*' to configDefaults.exclude.
In `@packages/client-generator-registry/vitest.config.ts`:
- Around line 1-7: Add a short doc comment above the exported Vitest
configuration (the default export created via defineConfig in vitest.config.ts)
that explains this is the package-specific Vitest config and explicitly states
why 'dist/*' is excluded (to avoid running tests against compiled/distributed
files); update the comment to reference that exclude merges with
configDefaults.exclude and that excluding 'dist/*' prevents duplicate/irrelevant
test runs from build artifacts.
In `@packages/dmmf/vitest.config.ts`:
- Around line 1-7: Add a brief doc comment above the exported default Vitest
config (the defineConfig export in this file) describing that this is the
package-specific Vitest configuration and explicitly noting why 'dist/*' is
added to the test.exclude list (to avoid running tests against
compiled/distributed artifacts). Update the comment to reference the exported
symbol (the default export from defineConfig) and mention the rationale for
excluding 'dist/*' so it satisfies the coding guideline requiring doc comments
for exported items.
In `@packages/ts-builders/vitest.config.ts`:
- Around line 1-7: Add a brief doc comment above the exported Vitest config (the
default export created via defineConfig) that describes this package-specific
test configuration and explicitly notes why 'dist/*' is excluded (to avoid
running tests against built artifacts/compiled output). Place the comment
immediately above the defineConfig(...) export and mention the test.exclude
setting so reviewers understand the intent.
In `@vitest.config.ts`:
- Around line 1-18: Add a JSDoc comment describing the exported Vitest
configuration object returned by defineConfig (the default export) that explains
its purpose and notes the use of test.projects with glob negation (e.g.,
'!packages/cli') as the intended multi-project setup; place the JSDoc
immediately above the export/default defineConfig call and include a brief
summary plus any relevant tags (e.g., `@returns` or `@see`) to satisfy the coding
guideline for exported items.
| import { configDefaults, defineConfig } from 'vitest/config' | ||
|
|
||
| export default defineConfig({ | ||
| test: { | ||
| exclude: [...configDefaults.exclude, 'dist/*'], | ||
| }, | ||
| }) |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
Add a doc comment for the exported config.
Please add a brief doc comment explaining the package-specific Vitest config and why dist/* is excluded.
✍️ Proposed doc comment
+/**
+ * Package-local Vitest config; excludes built artifacts from test discovery.
+ */
export default defineConfig({
test: {
exclude: [...configDefaults.exclude, 'dist/*'],
},
})As per coding guidelines, exported items should have doc comments.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { configDefaults, defineConfig } from 'vitest/config' | |
| export default defineConfig({ | |
| test: { | |
| exclude: [...configDefaults.exclude, 'dist/*'], | |
| }, | |
| }) | |
| import { configDefaults, defineConfig } from 'vitest/config' | |
| /** | |
| * Package-local Vitest config; excludes built artifacts from test discovery. | |
| */ | |
| export default defineConfig({ | |
| test: { | |
| exclude: [...configDefaults.exclude, 'dist/*'], | |
| }, | |
| }) |
🤖 Prompt for AI Agents
In `@packages/dmmf/vitest.config.ts` around lines 1 - 7, Add a brief doc comment
above the exported default Vitest config (the defineConfig export in this file)
describing that this is the package-specific Vitest configuration and explicitly
noting why 'dist/*' is added to the test.exclude list (to avoid running tests
against compiled/distributed artifacts). Update the comment to reference the
exported symbol (the default export from defineConfig) and mention the rationale
for excluding 'dist/*' so it satisfies the coding guideline requiring doc
comments for exported items.
|
@aqrln @jacek-prisma please review and let's merge this before #29032 |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@packages/credentials-store/package.json`:
- Around line 29-31: Update the devDependency "tempy" in package.json from
"1.0.1" to "3.1.0" (edit the devDependencies entry for "tempy") and regenerate
the lockfile by running your package manager (npm/yarn/pnpm install) so the
updated version is recorded; ensure tests still pass and update any import/usage
if the newer tempy API requires minor adjustments in the codebase.
| "devDependencies": { | ||
| "tempy": "1.0.1", | ||
| "vitest": "3.2.4" | ||
| "tempy": "1.0.1" | ||
| }, |
There was a problem hiding this comment.
🧹 Nitpick | 🔵 Trivial
🧩 Analysis chain
🌐 Web query:
tempy npm latest version and compatibility
💡 Result:
Latest npm version: 3.1.0 (published ~2 years ago). [1][2]
Node compatibility: tempy@3.1.0 requires Node.js >= 14.16.0 (package engines). [3]
Install: npm install tempy. [1]
Sources:
- npm package page (tempy 3.1.0). [1]
- Snyk package summary (latest 3.1.0). [2]
- package-lock / registry metadata showing "engines": "node": ">=14.16". [3]
🏁 Script executed:
# Find root package.json to check Node/runtime constraints
find . -maxdepth 2 -name "package.json" -type f | head -5Repository: prisma/prisma
Length of output: 71
🏁 Script executed:
# Check for .nvmrc or node version specifications
git ls-files | grep -E "(\\.nvmrc|\\.(tool-versions|node-version)|package\\.json)"Repository: prisma/prisma
Length of output: 12647
🏁 Script executed:
# Read root package.json to check Node version constraints
cat ./package.json | head -50Repository: prisma/prisma
Length of output: 2120
🏁 Script executed:
# Read the full credentials-store package.json to see how tempy is used
cat ./packages/credentials-store/package.jsonRepository: prisma/prisma
Length of output: 983
🏁 Script executed:
# Search for tempy usage in credentials-store package
rg "tempy" packages/credentials-store --type ts --type js --type json -B 2 -A 2Repository: prisma/prisma
Length of output: 1084
🌐 Web query:
tempy npm package changelog breaking changes version 1.0.1 to 3.1.0
💡 Result:
Do you want me to fetch the package's GitHub/npm release notes and list every breaking change between 1.0.1 and 3.1.0? (I'll look up and cite the sources.)
🌐 Web query:
tempy 1.0.1 breaking changes security issues npm
💡 Result:
Short answer: There are no widely reported breaking changes or security vulnerabilities specifically tied to tempy@1.0.1 in public advisories. Public package scans (ReversingLabs / Spectra, Snyk) and npm package metadata show no known vulnerabilities for tempy, and the package's changelogs/releases do not list a breaking-change notice for a 1.0.1 release. [1][2][3]
Sources:
- npm package info / versions for tempy. [1]
- ReversingLabs Spectra Assure scan (no known vulnerabilities found). [2]
- Snyk / general vulnerability tracking for temp-like packages (no active advisories for tempy). [3]
If you want, I can:
- fetch the tempy GitHub release/CHANGELOG and quote the exact 1.0.1 entry, or
- run a fresh security scan of a specific tarball or version you care about.
🌐 Web query:
tempy package GitHub releases 3.0.0 2.0.0 breaking changes
💡 Result:
Do you mean the npm package "tempy" (sindresorhus/tempy)? If so I can fetch the GitHub release notes and list the breaking changes between v2.0.0 and v3.0.0 — shall I look them up now?
Update tempy to the latest version (3.1.0) for better maintenance.
While tempy 1.0.1 is compatible with the repository's Node version requirement (20.19+), it is significantly outdated. The latest version 3.1.0 has no reported breaking changes and should be a safe upgrade for this test utility.
🤖 Prompt for AI Agents
In `@packages/credentials-store/package.json` around lines 29 - 31, Update the
devDependency "tempy" in package.json from "1.0.1" to "3.1.0" (edit the
devDependencies entry for "tempy") and regenerate the lockfile by running your
package manager (npm/yarn/pnpm install) so the updated version is recorded;
ensure tests still pass and update any import/usage if the newer tempy API
requires minor adjustments in the codebase.
Merging this PR will degrade performance by 98.39%
Performance Changes
Comparing |
|
@aqrln please review and approve workflow |
|
I approved the workflows, looks like there's a number of failing jobs |
|
closing in favor of #29142 |
This PR consolidates Vitest execution utilizing its concurrency management thus improve DX.
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.