Sharing/using jest mocks with external unlocked/managed package dependencies
joeythomaschaske opened this issue · comments
Summary
With sfdx, developers are encouraged to break up their "happy soup" into separate unlocked packages. Additionally with 2GP packages, package developers can develop distinct packages that can be dependent on other 2GP packages.
This leads to engineers either picking a monolithic repo approach, or breaking up their packages into separate repos. As an adopter of CumulusCI, we do the latter approach. A challenge with this adoption is sharing jest mocks from one package/repo to another package/repo that is dependent on it.
Users of the lwc-recipes repo might benefit by having an example of an external unlocked package that contains lwcs that this repo relies on and how to configure this repo to use that repo's jest mock files
Suggested Solution
A solution I am exploring is publishing the jest mocks to a private npm registry, so that any package this is dependent on the package can also install the associated npm package with it and configure jest to use the mocks from the node_modules
folder
Alternative Solutions
A more crude solution is to just force dependent packages to write their own mocks for the packages they are dependent on. But these could break with future updates to the package.
Code of Conduct
- I agree to follow this project's Code of Conduct
Thank you for posting this issue. 🙇🏼♂️
We will come back to you shortly.
Hi, the sfdx-lwc-jest might not be fully compatible with the Node.js ecosystem as mentioned in the other repository's comment. Considering this, I'm closing this issue. Feel free to ask if you need more info. Thank you!