I am trying to test a spfx webpart component and I am getting the following error:
Test suite failed to run
Cannot find module 'WebPartContentStrings' from 'WebContentContainer.tsx'
I did some digging and I found that inside my component I do the following:
import * as strings from "WebPartContentStrings";
And I have this file:
declare module 'WebPartContentStrings' {
const strings: IWebPartContentStrings;
export = strings;
}
However, it seems when I mock the component Jest cannot interpret the import instruction correctly and cannot find the module even though the application can find it when I host it on a server. Is there a way to import the strings in a different way for Jest?