-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
erroneous ArrayBuffer polyfill when using node environment with node 7+ #3186
Comments
i haven't looked deep into the issue, but what i found interesting is:
and right after that
|
ok. sorry, i missed |
it consistently fails on all node versions that i tried, even without Jest.
This is probably related to this change: |
@DmitriiAbramov hm you're right that all of a sudden I can't repro the success case with earlier version of node - I'll work on updating that. In the meantime, your test is incorrect above, you need to check the constructor name of the
So what we are seeing here is that in both versions of node the returned buffer has an internal |
@DmitriiAbramov the problem seems to be with the setup of your node environment here: https://github.com/facebook/jest/blob/master/packages/jest-environment-node/src/index.js#L29-L38 Specifically, I think this line:
thinks its making a copy of the global node context, but it isn't at all (if you run that locally you'll see the result is For instance, why not just say |
ah. i know what's going on there. The change that you suggested would fix the issue, since the it will share the same object between two environments. We don't share all properties between outer and inner context, because if a test modifies something shared one thing i'm not sure is why |
ok. i'm not sure what exactly is going on, but it seems like the |
@DmitriiAbramov are you sure? That should mean I could explicitly set |
I encountered this issue when writing some integration tests using the I set Creating and using a custom environment solved it, code below: const NodeEnvironment = require('jest-environment-node')
module.exports = class ArrayBufferEnvironment extends NodeEnvironment {
constructor(config) {
super(config)
this.global.ArrayBuffer = ArrayBuffer
}
} |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Do you want to request a feature or report a bug?
bug
What is the current behavior?
When working with
ArrayBuffer
s, it appears that when jest is run using thenode
environment (--env node
) a polyfill is being used forArrayBuffer
incorrectly only in node v7+. It is unclear to me if this really is a jest-specific problem, but it does seem to be related to the jest environment.If the current behavior is a bug, please provide the steps to reproduce and either a repl.it demo through https://repl.it/languages/jest or a minimal repository on GitHub that we can
yarn install
andyarn test
.https://github.com/mbroadst/jest-arraybuffer-issue
yarn install && yarn test
and the test will passyarn install && yarn test
and the test will failWhat is the expected behavior?
the test passes
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
see: github repo
The text was updated successfully, but these errors were encountered: