Skip to content

fix(shared): Remove testUtils & smaller updates#1868

Merged
LekoArts merged 7 commits into
mainfrom
cleanup/shared-test-utils
Oct 12, 2023
Merged

fix(shared): Remove testUtils & smaller updates#1868
LekoArts merged 7 commits into
mainfrom
cleanup/shared-test-utils

Conversation

@LekoArts

@LekoArts LekoArts commented Oct 12, 2023

Copy link
Copy Markdown
Contributor

Description

While working on JS-509 I quickly realized that putting that into one big PR would be a mess. So this is a slice of work that can be shipped separately and removes some noise from the original purpose of that ticket.

This PR does a couple of things:

  • Remove testUtils from @clerk/shared. There's no need to put this into such a package, it can live inside the repo outside of a npm package. The contents of the testUtils were re-exports from @testing-library/react and an unused wrapper. So I didn't have to move it somewhere else, I just had to update the imports
  • Fix the Jest config @clerk/shared. Through an incorrect testRegex one test was never run. Jest's defaults are fine for our use case, so we don't even need to set it
  • Remove the package.json we put into dist/cjs and dist/esm. They have no benefit since the root package.json already has sideEffects defined.
  • Add peerDependenciesMeta to make react peerDep optional
  • Use correct LICENSE
  • Add author

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

@changeset-bot

changeset-bot Bot commented Oct 12, 2023

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: b5955bb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
@clerk/shared Patch
@clerk/backend Patch
@clerk/clerk-js Patch
@clerk/clerk-expo Patch
@clerk/fastify Patch
@clerk/nextjs Patch
@clerk/clerk-react Patch
@clerk/remix Patch
@clerk/clerk-sdk-node Patch
gatsby-plugin-clerk Patch
@clerk/chrome-extension Patch

Not sure what this means? Click here to learn what changesets are.

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

Comment thread packages/clerk-js/src/utils/__tests__/ignoreEventValue.test.ts

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These were just all re-exports that did nothing

@@ -1,11 +1 @@
import '@testing-library/jest-dom';

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We had @testing-library/jest-dom/extend-expect in our testUtils file. This line already covers this

@LekoArts
LekoArts marked this pull request as ready for review October 12, 2023 09:38
@LekoArts
LekoArts requested a review from a team as a code owner October 12, 2023 09:38
@@ -0,0 +1,9 @@
---
"@clerk/shared": patch

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔧 I think that changing the public API (eg removing an export in our case) of a package requires a major version bump.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It's an internal package without a README only used by our Jest tests that we also don't tell people to install or use. It'd consider it purely internal.

So while technically you're correct, I wouldn't care about that :)

Comment thread packages/clerk-js/src/utils/__tests__/ignoreEventValue.test.ts
@LekoArts
LekoArts added this pull request to the merge queue Oct 12, 2023

@nikosdouvlis nikosdouvlis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Awesome job @LekoArts 🔥

Remove the package.json we put into dist/cjs and dist/esm. They have no benefit since the root package.json already has sideEffects defined.

For future reference, old Vite React apps weren't picking up the root package.json's sideEffects prop. It seems that this has been fixed since then so all changes in this PR as spot on.

@clerk-cookie

Copy link
Copy Markdown
Collaborator

This PR has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@clerk clerk locked as resolved and limited conversation to collaborators Oct 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants