Skip to content
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

feat(backend): vitest #4296

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

feat(backend): vitest #4296

wants to merge 10 commits into from

Conversation

jacekradko
Copy link
Contributor

@jacekradko jacekradko commented Oct 7, 2024

Description

Spiking out vitest test runner as a replacement for qunit in @clerk/backend

Related: https://linear.app/clerk/issue/SDKI-694/refactor-clerkbackend-to-use-vitest-instead-of-qunit

Checklist

  • npm test runs as expected.
  • npm run build runs as expected.
  • (If applicable) JSDoc comments have been added or updated for any package exports
  • (If applicable) Documentation has been updated

Type of change

  • 🐛 Bug fix
  • 🌟 New feature
  • 🔨 Breaking change
  • 📖 Refactoring / dependency upgrade / documentation
  • other:

Copy link

changeset-bot bot commented Oct 7, 2024

⚠️ No Changeset found

Latest commit: f1a2dcf

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -88,7 +88,7 @@ export function buildRequest(options: BuildRequestOptions) {
let res: Response | undefined;
try {
if (formData) {
res = await runtime.fetch(finalUrl.href, {
res = await (process.env.NODE_ENV === 'test' ? fetch : runtime.fetch)(finalUrl.href, {
Copy link
Contributor Author

@jacekradko jacekradko Oct 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will need to think about a more ergonomic way of accomplishing this. With the way fetch is handled in the package, msw can't intercept requests without it for now

});
expect(jwk).toMatchObject(mockRsaJwk);
jwk = await loadClerkJWKFromRemote({
secretKey: 'deadbeef',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical test

The hard-coded value "deadbeef" is used as
authorization header
.
// cache should be cleared, but 5m ttl is still valid
fakeClock.next();
jwk = await loadClerkJWKFromRemote({
secretKey: 'deadbeef',

Check failure

Code scanning / CodeQL

Hard-coded credentials Critical test

The hard-coded value "deadbeef" is used as
authorization header
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants