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

Different behavior with window global scope in newer Node.js versions #3675

Closed
ndresx opened this issue May 28, 2017 · 3 comments
Closed

Different behavior with window global scope in newer Node.js versions #3675

ndresx opened this issue May 28, 2017 · 3 comments

Comments

@ndresx
Copy link
Contributor

ndresx commented May 28, 2017

Do you want to request a feature or report a bug?
bug?

What is the current behavior?
When deleting something from the global window scope during 2 test runs, the behavior is different when using for example Node.js 7.4.0 (2nd test passes) and 7.9.0/7.10.0 (2nd test fails).

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 and yarn test.
https://repl.it/IVBE/7

What is the expected behavior?
I don't know what the expected behavior should be, but I guess the one on newer Node.js versions where the second test is failing because the key was deleted seems to be the right one. That might not be even a Jest related issue, or an issue at all?

 FAIL  src\add-test.js
  ● require › case 2

    TypeError: Cannot read property 'value' of undefined

      at Object.<anonymous> (src/add-test.js:12:28)
      at Promise.resolve.then.el (node_modules/p-map/index.js:42:16)
      at process._tickCallback (internal/process/next_tick.js:109:7)

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.
Jest: 19.0.2 and 20.0.4
Node.js: 7.4.0 (working) and 7.9.0/7.10.0 (not working)

@ndresx ndresx closed this as completed May 28, 2017
@ndresx ndresx changed the title Different behavior with require.requireMock in latest Node.js versions Different behavior with window global scope in newer Node.js versions May 28, 2017
@ndresx
Copy link
Contributor Author

ndresx commented May 28, 2017

Have rewritten the example so that it really only focuses on the here stated problem.

@ndresx ndresx reopened this May 28, 2017
@thymikee
Copy link
Collaborator

thymikee commented Oct 5, 2017

Hah, so I was super curious about this because WTF, you can delete from global objects in newer Node versions but cannot do this in LTS 4 nor LTS 6. So I dug a little bit and this is actually a fix in vm module, see relevant PR: nodejs/node#11266

You'll find a reference in Node 7.6 changelog: https://github.com/nodejs/node/blob/master/doc/changelogs/CHANGELOG_V7.md#2017-02-21-version-760-current-italoacasas

Closing then, happy testing and sorry for the delay 😄

@thymikee thymikee closed this as completed Oct 5, 2017
@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 13, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants