Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work around a jest/nodejs issue where instanceof ArrayBuffer fails #598

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ericvergnaud
Copy link

Work around a jest/nodejs issue where instanceof ArrayBuffer fails due to a nodes sandbox issue
See nodejs/node#20978, marked as fixed, but seems to resurface with node 10.15.3 and jest 24.7.1

…e to a nodes sandbox issue

See nodejs/node#20978, marked as fixed, but seems to resurface with node 10.15.3 and jest 24.7.1
@gabberr
Copy link

gabberr commented Oct 3, 2022

The use of instanceof ArrayBuffer is also problematic in Safari. Checking instanceof of an ArrayBuffer in the window context will return false for ArrayBuffers created in a different context, e.g. an iframe. I think this should fix it 👍

See:
feross/buffer#166

The test environment is that of the Karma test runner, which uses an iframe to isolate test code from the runner's code. As a result, the ArrayBuffer constructor object in the code's context is not referentially equivalent to the ArrayBuffer constructor object in the main window context.

There was a similar fix in this repo for the Blob

#350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants