-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
test(tracing): Add Prisma ORM integration tests. #4962
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
Conversation
size-limit report 📦
|
cd05531
to
520fd0d
Compare
release: '1.0', | ||
tracesSampleRate: 1.0, | ||
// @ts-ignore: We can't determine the type of the client from the integration | ||
integrations: [new Tracing.Integrations.Prisma({ client })], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't this ts-ignore
mean that this will happen to any user? That kinda feels like bad UX. Could we change the client type to something unknown
, validate it as a PrismaClient
and throw an error if it isn't?
declare function isValidPrismaClient(possibleClient: unknown): possibleClient is PrismaClient;
public constructor(options: { client?: unknown } = {}) {
if (isValidPrismaClient(options.client)) {
this._client = options.client;
} else {
// TODO: Make a better logging message
logger.warn(`Incorrect prisma client provided. Provided client: ${JSON.stringify(client)}`);
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that's right, updated 👍
0040b0f
to
299aeb3
Compare
@onurtemizkan Could you rebase this please? Let's try to get this in! |
8eb0ab3
to
4025da9
Compare
4025da9
to
d87b92c
Compare
Add integration tests for Prisma ORM integration based on https://www.prisma.io/docs/guides/testing/integration-testing. Also update integration perform validation on Prisma Client.
Based and depends on #4931
These integration tests are a bit more complex than the others, because Prisma needs to generate its engine, and that engine requires a working database connection, which expects a valid migration declaration, and so on.
Ref: https://www.prisma.io/docs/guides/testing/integration-testing