Skip to content

Conversation

@facuacostag
Copy link

@facuacostag facuacostag commented Sep 10, 2024

Issue

Version 4.3.0 changed how files were exported in the package.json as you can see in this commit. If you were mocking the library on Jest so tests could pass, the new configuration wasn't allowing Jest to find the package to be mocked.

Screenshot 2024-09-10 at 09 56 34

Solution

Adding require to to each of the exports solves the issue and allows Jest to work again.

@facuacostag
Copy link
Author

@microsoft-github-policy-service agree

@facuacostag facuacostag requested a review from MSNev September 12, 2024 15:05
@EleryanYuri
Copy link

Hello,

My team is facing issue that this PR would solve.
We have a really strict policy about code coverage and being unable to mock the package is a really painfull

Thanks for providing it and I hope this will be soon taken into account.

@MSNev MSNev requested review from a team and Karlie-777 and removed request for MSNev May 15, 2025 16:10
@Karlie-777 Karlie-777 requested a review from Copilot July 11, 2025 20:13
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a CommonJS entry point to the package exports so Jest can correctly mock the library.

  • Adds a require mapping under the root export to point to the CJS build.
  • Ensures Jest can resolve the module when running tests.

"react-native-device-info": {
"optional": true
}
"./manual": {
Copy link

Copilot AI Jul 11, 2025

Choose a reason for hiding this comment

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

The ./manual export block currently only defines types. You should add a require mapping (e.g., "require": "./dist/manualIndex.js") so Jest can resolve the CommonJS path for the manual entry as well.

Copilot uses AI. Check for mistakes.
@Karlie-777
Copy link
Contributor

#78

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.

5 participants