test: speed up prisma script tests and merge --bun script tests - #1150
Conversation
Create SQLite fixtures with node:sqlite instead of spawning the Prisma CLI, keep the single real Prisma invocation on bunx with telemetry disabled, and merge the three `bun --bun` rewrite tests into one generator call. Cuts the wb prismaScripts test file from ~29s to ~5s. Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request focuses on improving the performance of the test suite by eliminating redundant external process calls and consolidating overlapping test cases. By leveraging native Node.js SQLite capabilities and suppressing unnecessary network calls in the Prisma CLI, the build pipeline sees a meaningful reduction in total test duration. Highlights
New Features🧠 You can now enable Memory (public preview) to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Tests were slow and took their time, Running Prisma, quite a crime. Now with SQLite, fast and lean, The test suite runs like a machine. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request replaces slow Prisma CLI invocations with Node's native DatabaseSync from node:sqlite in the Prisma script unit tests, and optimizes the test environment by disabling Prisma telemetry. It also consolidates and expands the test cases for stripping bun --bun from package.json scripts. The review feedback suggests wrapping the DatabaseSync operations in try...finally blocks to guarantee that database connections are properly closed even if errors occur during execution.
Co-authored-by: WillBooster (Claude Code) <agent@willbooster.com>
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request optimizes the Prisma script tests in the wb package by replacing slow Prisma CLI invocations with direct SQLite operations using DatabaseSync, switching the test command to bunx, and disabling Prisma telemetry. Additionally, it consolidates several test cases in wbfy related to stripping bun --bun from package scripts. There are no review comments, and I have no feedback to provide.
Customer Summary
Technical Summary
packages/wb/test/unit/scripts/prismaScripts.test.ts(~29s → ~3s under vitest):node:sqlite(DatabaseSync, still a real WAL-mode database) instead of spawningnpx prisma db executeper fixture, closing connections viatry...finally.node:sqliteinstead of aprisma db pullintrospection.cleanUpLitestreamcommand, the behavior under test) now runs viabunxwithCHECKPOINT_DISABLE=1, skipping the telemetry network call that dominated CLI startup (~12s → ~4s per spawn locally).packages/wbfy/test/unit/packageJson.test.ts: merged the threebun --bunrewrite tests (identical config, disjoint script names) into a singlegeneratePackageJsoncall; therun-target/script-name relationships the tests rely on (buildexists → alias,serverabsent → file) are preserved.Why
wbpackage's test time, and almost all of it was Prisma CLI startup and telemetry overhead rather than the behavior under test.wbfy/test/unit/packageJson.test.ts, ~40s) is dominated by one-time synchronousnpm show <dep> versionregistry lookups in the generator (warmgeneratePackageJsoncalls take ~10ms), so further test merging there would not reduce runtime. Speeding that up would need parallelized/batched version lookups inwbfyitself — left as a possible follow-up.cleanupIdempotency,maintenanceCommand,typecheck,setup) are genuine E2E flows and were left untouched.Testing
bun verify-fullpassed (typecheck + lint + all tests; tests 1m 1s).bun vitest run test/unit/scripts/prismaScripts.test.tsinpackages/wb: 5 passed in ~3s.bun vitest run test/unit/packageJson.test.tsinpackages/wbfy: 81 passed.🤖 Generated with Claude Code