I am trying to build some shared mocks for common utilities such as the lightning platform resource loader, which I mocked like so:
jest.mock(
'lightning/platformResourceLoader',
() => {
return {
loadScript() {
return new Promise((resolve, reject) => {
resolve();
});
}
};
},
{ virtual: true }
);
This is included in my tests, and I know jest support module mocking so I was wondering if the an alternative would be to place under my sfdx-project root a lightning/platformResourceLoader/__mocks__/platformResourceLoader.json
file. Is this the right approach to sharing mocks in lwc testing?