You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
I am running into issues with FileReader when running my jest tests.
This happens when I reference happy-dom jest-environment. testEnvironment: '@happy-dom/jest-environment',
I get following error running a test for a pure function:
reader.readAsDataURL is not a function
TypeError: reader.readAsDataURL is not a function
the funcrion I am testing:
export function convertBlobToBase64(blob: Blob): Observable<string> {
const reader = new FileReader();
> reader.readAsDataURL(blob);
return fromEvent(reader, 'load').pipe(map(() => (reader.result as string).split(',')[1]));
}
To Reproduce
Steps to reproduce the behavior:
Reference testEnvironment: '@happy-dom/jest-environment' in your test setup.
Write a jest test including FileReader.
Run the reader.readAsDataURL(..) function
See error
Expected behavior
FileReader should have a readAsDataURL function.
Screenshots
If applicable, add screenshots to help explain your problem.
Device:
OS: Windows
Browser Chrome
Additional context
I am working with an Angular project writing jest tests for util functions.
The text was updated successfully, but these errors were encountered:
Describe the bug
I am running into issues with FileReader when running my jest tests.
This happens when I reference happy-dom jest-environment.
testEnvironment: '@happy-dom/jest-environment',
I get following error running a test for a pure function:
the funcrion I am testing:
To Reproduce
Steps to reproduce the behavior:
testEnvironment: '@happy-dom/jest-environment'
in your test setup.Expected behavior
FileReader should have a readAsDataURL function.
Screenshots
If applicable, add screenshots to help explain your problem.
Device:
Additional context
I am working with an Angular project writing jest tests for util functions.
The text was updated successfully, but these errors were encountered: