salesforce / lightning-labs

MIT License
3 stars 4 forks source link

feat: provide mechanism to mock ES modules #3

Closed divmain closed 1 month ago

divmain commented 2 months ago

This adds mocking for ES modules. It uses imports themselves to declare that something needs to be mocked, as well as providing the mechanism for manipulating the mocked exports.

Currently, the exported names need to be explicitly added to the import mockController from 'mock{exported,names,here}:some/module' syntax. We may revisit that in the future to auto-detect exports of an existing module that is being mocked. That is out of scope for this PR.