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

Don't use instanceof ArrayBuffer, it breaks in Jest #8

Open
abonander opened this issue Aug 7, 2019 · 2 comments
Open

Don't use instanceof ArrayBuffer, it breaks in Jest #8

abonander opened this issue Aug 7, 2019 · 2 comments

Comments

@abonander
Copy link

I'm trying to use asn1js but I'm getting an error from checkBufferParams in this lib due to the following problem which was previously fixed but has cropped up again in Node v11.15.0: nodejs/node#20978 (comment)

The problem is that Uint8Array.prototype.buffer instanceof ArrayBuffer always returns false when running code in Jest. It doesn't make any sense (even inspecting the value shows a class of ArrayBuffer) but it seems to be a bug in the current V8 version of Node.

The popular workaround seems to be to check the constructor name strings instead: Stuk/jszip#598

@abonander abonander changed the title Don't use instanceof ArrayBuffer, it breaks around sandboxing like in Jest Don't use instanceof ArrayBuffer, it breaks in Jest Aug 7, 2019
@YuryStrozhevsky
Copy link
Contributor

@abonander I do not want to make a workarounds on well-known bugs. Let's wait for the bug to be fixed in Node.

@abonander
Copy link
Author

Node has announced that it's not their problem: nodejs/node#20978 (comment)

Jest has had an issue open since February: jestjs/jest#7780

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

No branches or pull requests

2 participants