diff --git a/.changeset/smart-rooms-refuse.md b/.changeset/smart-rooms-refuse.md new file mode 100644 index 00000000000..a845151cc84 --- /dev/null +++ b/.changeset/smart-rooms-refuse.md @@ -0,0 +1,2 @@ +--- +--- diff --git a/packages/tanstack-react-start/package.json b/packages/tanstack-react-start/package.json index ecab89ddfbb..cdb5a86ae5a 100644 --- a/packages/tanstack-react-start/package.json +++ b/packages/tanstack-react-start/package.json @@ -62,7 +62,9 @@ "lint": "eslint src", "lint:attw": "attw --pack . --profile esm-only", "lint:publint": "publint", - "publish:local": "pnpm yalc push --replace --sig" + "publish:local": "pnpm yalc push --replace --sig", + "test": "vitest run", + "test:watch": "vitest watch" }, "dependencies": { "@clerk/backend": "workspace:^", diff --git a/packages/tanstack-react-start/src/__tests__/__snapshots__/exports.test.ts.snap b/packages/tanstack-react-start/src/__tests__/__snapshots__/exports.test.ts.snap new file mode 100644 index 00000000000..089a3dcba56 --- /dev/null +++ b/packages/tanstack-react-start/src/__tests__/__snapshots__/exports.test.ts.snap @@ -0,0 +1,71 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`errors public exports > should not change unexpectedly 1`] = ` +[ + "EmailLinkErrorCode", + "EmailLinkErrorCodeStatus", + "isClerkAPIResponseError", + "isEmailLinkError", + "isKnownError", + "isMetamaskError", + "isReverificationCancelledError", +] +`; + +exports[`root public exports > should not change unexpectedly 1`] = ` +[ + "AuthenticateWithRedirectCallback", + "ClerkDegraded", + "ClerkFailed", + "ClerkLoaded", + "ClerkLoading", + "ClerkProvider", + "CreateOrganization", + "GoogleOneTap", + "OrganizationList", + "OrganizationProfile", + "OrganizationSwitcher", + "Protect", + "RedirectToCreateOrganization", + "RedirectToOrganizationProfile", + "RedirectToSignIn", + "RedirectToSignUp", + "RedirectToUserProfile", + "SignIn", + "SignInButton", + "SignInWithMetamaskButton", + "SignOutButton", + "SignUp", + "SignUpButton", + "SignedIn", + "SignedOut", + "UserButton", + "UserProfile", + "Waitlist", + "useAuth", + "useClerk", + "useEmailLink", + "useOrganization", + "useOrganizationList", + "useReverification", + "useSession", + "useSessionList", + "useSignIn", + "useSignUp", + "useUser", +] +`; + +exports[`server public exports > should not change unexpectedly 1`] = ` +[ + "clerkClient", + "createClerkHandler", + "getAuth", +] +`; + +exports[`webhooks public exports > should not change unexpectedly 1`] = ` +[ + "verifyWebhook", +] +`; diff --git a/packages/tanstack-react-start/src/__tests__/exports.test.ts b/packages/tanstack-react-start/src/__tests__/exports.test.ts new file mode 100644 index 00000000000..fc39dba23b7 --- /dev/null +++ b/packages/tanstack-react-start/src/__tests__/exports.test.ts @@ -0,0 +1,28 @@ +import * as errorsExports from '../errors'; +import * as publicExports from '../index'; +import * as serverExports from '../server/index'; +import * as webhooksExports from '../webhooks'; + +describe('root public exports', () => { + it('should not change unexpectedly', () => { + expect(Object.keys(publicExports).sort()).toMatchSnapshot(); + }); +}); + +describe('server public exports', () => { + it('should not change unexpectedly', () => { + expect(Object.keys(serverExports).sort()).toMatchSnapshot(); + }); +}); + +describe('errors public exports', () => { + it('should not change unexpectedly', () => { + expect(Object.keys(errorsExports).sort()).toMatchSnapshot(); + }); +}); + +describe('webhooks public exports', () => { + it('should not change unexpectedly', () => { + expect(Object.keys(webhooksExports).sort()).toMatchSnapshot(); + }); +}); diff --git a/packages/tanstack-react-start/vitest.config.mts b/packages/tanstack-react-start/vitest.config.mts new file mode 100644 index 00000000000..5fcd8bde40b --- /dev/null +++ b/packages/tanstack-react-start/vitest.config.mts @@ -0,0 +1,9 @@ +import { defineConfig } from 'vitest/config'; + +export default defineConfig({ + test: { + globals: true, + environment: 'jsdom', + setupFiles: './vitest.setup.mts', + }, +}); diff --git a/packages/tanstack-react-start/vitest.setup.mts b/packages/tanstack-react-start/vitest.setup.mts new file mode 100644 index 00000000000..fd83ef151c1 --- /dev/null +++ b/packages/tanstack-react-start/vitest.setup.mts @@ -0,0 +1,3 @@ +globalThis.__DEV__ = true; +globalThis.PACKAGE_NAME = '@clerk/tanstack-react-start'; +globalThis.PACKAGE_VERSION = '0.0.0-test';