-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
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
Unable to delete things from global. #3152
Comments
Hi! Thanks for reporting this I think it has to do with |
looks like it has been fixed here nodejs/node#11266 |
yeah. i can confirm that it works on node
|
Ooph, so we'll have to update node to get around this? |
@gdborton that would be the easiest! |
Except in the most recent versions of node, developers are unable to delete things from global when running code in a node vm. This means that enzyme is failing to clean up after itself when temporarily defining global.document for setState calls. This papers over the issue by explicitly setting global.document to undefined if it failed to be deleted. Relevant jest issue - jestjs/jest#3152 Relevant node pr - nodejs/node#11266
Except in the most recent versions of node, developers are unable to delete things from global when running code in a node vm. This means that enzyme is failing to clean up after itself when temporarily defining global.document for setState calls. This papers over the issue by explicitly setting global.document to undefined before attempting to delete. If the delete succeeds, the undefined value will be removed. Relevant jest issue - jestjs/jest#3152 Relevant node pr - nodejs/node#11266
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?
delete global.someProp
doesn't work.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
.Repl.it - https://repl.it/GXd3
What is the expected behavior?
delete global.someProp
should makeglobal.someProp === undefined
true.This works in mocha, jasmine, plain old node, and I think it works when running via
vm
. We're investigating a move to Jest, but are running into some subtle issues related to this.For example this function in enzyme doesn't behave correctly - https://github.com/airbnb/enzyme/blob/master/src/Utils.js#L213
We could attempt to work around this, but I feel like this will repeatedly come up in our codebase and will lead to lots of wasted time.
Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
node - v4.6.2
npm - 2.15.11
jest - v19.0.0
os - OSX Sierra v10.12.1
The text was updated successfully, but these errors were encountered: