Handing code that uses document.createElement('script') #1482
-
I'm using I have a react hook that uses
I noticed this topic so tried
I also tried mocking fetch in What is the best way to handle the scenario where I need to place a script tag but don't want to make the actual network call? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was reading through this page, and tried the following options and it seems to have silenced the errors.
I'm not sure if its the appropriate way to do it, but here is how I've implemented it in the test suite: beforeAll(() => {
// see https://github.com/capricorn86/happy-dom/wiki/IOptionalBrowserSettings
vi.stubGlobal('happyDOM', merge(('happyDOM' in global) ? global.happyDOM : {}, { settings: { disableJavaScriptFileLoading: true, handleDisabledFileLoadingAsSuccess: true } }));
});
afterAll(() => {
vi.unstubAllGlobals();
}); I will go with it for now, but let me know if I should be doing something else |
Beta Was this translation helpful? Give feedback.
I was reading through this page, and tried the following options and it seems to have silenced the errors.
I'm not sure if its the appropriate way to do it, but here is how I've implemented it in the test suite:
I will go with it for now, …