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

chore(repo): Introduce integration test for vite with sdk-node #1921

Merged
merged 6 commits into from
Nov 17, 2023

Conversation

dimkl
Copy link
Contributor

@dimkl dimkl commented Oct 19, 2023

Description

Add integration test to verify that @clerk/shared tree-shaking works in backend application that do not use react as dependency.
We have introduced an Express + Vite template application that uses @clerk/clerk-sdk-node with the following endpoints

  • /api/protected endpoint that uses expressRequireAuth() from @clerk/clerk-sdk-node to verify authentication
  • /sign-in renders HTML that mounts <SignIn/> client-side component using ClerkJS
  • /sign-up renders HTML that mounts <SignUp/> client-side component using ClerkJS
  • /protected renders HTML SignedIn or SignedOut context and makes a request to the /api/protected to fetch the response that will be appended in body and asserted via playwright.

#1883

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:

Packages affected

  • @clerk/clerk-js
  • @clerk/clerk-react
  • @clerk/nextjs
  • @clerk/remix
  • @clerk/types
  • @clerk/themes
  • @clerk/localizations
  • @clerk/clerk-expo
  • @clerk/backend
  • @clerk/clerk-sdk-node
  • @clerk/shared
  • @clerk/fastify
  • @clerk/chrome-extension
  • gatsby-plugin-clerk
  • build/tooling/chore

@dimkl dimkl self-assigned this Oct 19, 2023
@dimkl dimkl requested a review from a team as a code owner October 19, 2023 12:57
@changeset-bot
Copy link

changeset-bot bot commented Oct 19, 2023

⚠️ No Changeset found

Latest commit: d8f6a05

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

@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch from 3bb7dc0 to dba7225 Compare October 19, 2023 13:11
@dimkl dimkl marked this pull request as draft October 23, 2023 19:51
@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch from dba7225 to d5ff6c6 Compare October 31, 2023 21:08
@dimkl dimkl requested a review from a team November 1, 2023 13:29
@dimkl dimkl changed the title Js 509 add vite clerk sdk node test chore(repo): Introduce integration test for vite with sdk-node Nov 6, 2023
@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch from d5ff6c6 to 361dc31 Compare November 6, 2023 12:34
@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch from 361dc31 to 9f6e819 Compare November 6, 2023 12:38
@dimkl dimkl marked this pull request as ready for review November 6, 2023 12:39
@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch 4 times, most recently from f96d40a to 9f5e433 Compare November 7, 2023 14:08
} else {
// since we have moved the integrations outside the monorepo we should fallback to * in case
// of empty version for non Clerk packages (eg next should install the latest version)
dependencies.set(name, '*');
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@nikosdouvlis PTAL this changes as it affect what version we expect to use in our integration tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I replaced this change with the following actions:

  • drop default * version
  • move the logic to link our packages to local folders in the presets to avoid polluting the ApplicationConfig model with Clerk-specific logic.
    cc: @nikosdouvlis

@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch from 9f5e433 to 2a11c7e Compare November 8, 2023 11:56
Copy link
Member

@BRKalow BRKalow left a comment

Choose a reason for hiding this comment

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

👏

@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch 3 times, most recently from 294d4b8 to 3232bc4 Compare November 16, 2023 18:23
This change will help us avoid accidentally using
top-level node_modules/ from the current monorepo
and will allow us to run tests isolated from the
monorepo related dependencies.
We had to use a folder outside the monorepo for
the integration tests to avoid having the npm
module resolution algorithm find unrelated dependencies.
@dimkl dimkl force-pushed the js-509-add-vite-clerk-sdk-node-test branch from 3232bc4 to d8f6a05 Compare November 17, 2023 08:56
@dimkl dimkl enabled auto-merge November 17, 2023 08:59
@dimkl dimkl added this pull request to the merge queue Nov 17, 2023
Merged via the queue into main with commit 9a121fe Nov 17, 2023
7 checks passed
@dimkl dimkl deleted the js-509-add-vite-clerk-sdk-node-test branch November 17, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants