test(e2e): Add node-prisma-8 test app - #24683
Conversation
|
bugbot run |
size-limit report 📦
|
eafb4a8 to
0c1f8e0
Compare
|
bugbot run |
0c1f8e0 to
434f927
Compare
|
bugbot run |
434f927 to
6384c38
Compare
|
bugbot run |
| res.json({ created: created.id, count: users.length }); | ||
| }); | ||
|
|
||
| Sentry.setupExpressErrorHandler(app); |
There was a problem hiding this comment.
l: I think this is not needed anymore. If it is needed it's a bug
| Sentry.setupExpressErrorHandler(app); |
6384c38 to
99d2534
Compare
|
bugbot run |
| ); | ||
| expect(queriesUnder('all')).toEqual([expect.stringMatching(/^SELECT .* FROM "public"\."user"$/)]); | ||
| expect(queriesUnder('delete')).toEqual( | ||
| expect.arrayContaining([expect.stringMatching(/^DELETE FROM "public"\."user" /)]), |
There was a problem hiding this comment.
Bug: The test at prisma.test.ts:69 incorrectly assumes a specific order for asynchronous spans by using .toEqual(), which will cause flaky test failures.
Severity: MEDIUM
Suggested Fix
Replace the .toEqual(OPERATION_METHODS) assertion with expect.unordered(OPERATION_METHODS). This will validate that all expected spans are present without enforcing a strict order, making the test robust against non-deterministic span emission.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location:
dev-packages/e2e-tests/test-applications/node-prisma-8/tests/prisma.test.ts#L69
Potential issue: The test at `prisma.test.ts:69` asserts that Prisma operation spans are
received in a specific order (`['create', 'all', 'delete']`) by using `toEqual`.
However, even with sequential `await` calls in the application code, the asynchronous
nature of span emission and collection means their order is not guaranteed. This
non-determinism is acknowledged in a similar, existing integration test which uses
`.unordered()` for the same type of assertion. The current implementation will cause the
test to be flaky and fail intermittently in CI.
Did we get this right? 👍 / 👎 to inform future reviews.
|
bugbot run |
Express app on Prisma 8 rc.8 with Postgres 16 in Docker, asserting the `prisma:client:operation` spans and the `pg` spans nested under them through the runtime hook. Refs #24237 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
99d2534 to
eaec6e9
Compare
|
bugbot run |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want reviews to match your repository better? Bugbot Learning can learn team-specific rules from PR activity. A team admin can enable Learning in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 99d2534. Configure here.
| import postgres from '@prisma/orm-postgres/runtime'; | ||
| import express from 'express'; | ||
| import type { Contract } from './prisma/contract.d.ts'; | ||
| import contractJson from './prisma/contract.json' with { type: 'json' }; |
There was a problem hiding this comment.
JSON contract missing from dist
High Severity
app.ts imports ./prisma/contract.json, and start runs the compiled dist/app.js. tsc does not emit JSON into outDir, so the relative import resolves to a missing dist/prisma/contract.json and the process exits before the e2e app can serve /test-prisma.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit 99d2534. Configure here.
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit eaec6e9. Configure here.


Express app on Prisma 8 rc.8 with Postgres 16 in Docker, asserting the operation spans and the
pgspans nested under them.Refs #24237