Skip to content

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

Merged
merged 3 commits into from
Apr 29, 2022

Conversation

onurtemizkan
Copy link
Collaborator

@onurtemizkan onurtemizkan commented Apr 21, 2022

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

@github-actions
Copy link
Contributor

github-actions bot commented Apr 21, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 18.29 KB (-9.18% 🔽)
@sentry/browser - ES5 CDN Bundle (minified) 57.25 KB (-11.4% 🔽)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 17.07 KB (-9.48% 🔽)
@sentry/browser - ES6 CDN Bundle (minified) 51.49 KB (-11.19% 🔽)
@sentry/browser - Webpack (gzipped + minified) 18.74 KB (-19.37% 🔽)
@sentry/browser - Webpack (minified) 60.65 KB (-25.78% 🔽)
@sentry/react - Webpack (gzipped + minified) 18.76 KB (-19.4% 🔽)
@sentry/nextjs Client - Webpack (gzipped + minified) 42.43 KB (-11.7% 🔽)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 24.08 KB (-7.67% 🔽)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 22.64 KB (-7.51% 🔽)

@onurtemizkan onurtemizkan force-pushed the onur/prisma-orm-integration-tests branch from cd05531 to 520fd0d Compare April 21, 2022 18:04
@onurtemizkan onurtemizkan marked this pull request as ready for review April 21, 2022 18:12
@AbhiPrasad AbhiPrasad requested review from a team, lobsterkatie and AbhiPrasad and removed request for a team April 21, 2022 18:15
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 })],
Copy link
Member

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)}`);
  }
}

Copy link
Collaborator Author

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 👍

@AbhiPrasad AbhiPrasad added this to the 7.0.0 milestone Apr 25, 2022
@lobsterkatie lobsterkatie force-pushed the 7.x branch 2 times, most recently from 0040b0f to 299aeb3 Compare April 26, 2022 22:40
@AbhiPrasad
Copy link
Member

@onurtemizkan Could you rebase this please? Let's try to get this in!

@onurtemizkan onurtemizkan force-pushed the onur/prisma-orm-integration-tests branch from 8eb0ab3 to 4025da9 Compare April 29, 2022 06:53
@onurtemizkan onurtemizkan force-pushed the onur/prisma-orm-integration-tests branch from 4025da9 to d87b92c Compare April 29, 2022 07:38
@AbhiPrasad AbhiPrasad merged commit e16a699 into 7.x Apr 29, 2022
@AbhiPrasad AbhiPrasad deleted the onur/prisma-orm-integration-tests branch April 29, 2022 19:00
AbhiPrasad pushed a commit that referenced this pull request May 30, 2022
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants