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

Fix test and improve process sandboxing #5027

Merged
merged 1 commit into from
Dec 6, 2017
Merged

Fix test and improve process sandboxing #5027

merged 1 commit into from
Dec 6, 2017

Conversation

mjesun
Copy link
Contributor

@mjesun mjesun commented Dec 6, 2017

The native EventEmitter module will not create an _events collection, if there is already an existing one (see code here).

This causes that the existing listeners are not re-initialized in the deep copied process object, so tests triggering listeners will also trigger the original Jest listeners. The fix is simple: avoid copying the _events property so the object gets re-initialized.

Also fixes the ./child test from jest-worker when running in parallel mode.

@cpojer
Copy link
Member

cpojer commented Dec 6, 2017

Time to turn it into a whitelist? ;P

@mjesun
Copy link
Contributor Author

mjesun commented Dec 6, 2017

I think it's better to break when an option is wrongly copied than silently missing one recently added (unless the blacklist becomes bigger than 5-6 options; in which case I'd agree)

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hah, such a tiny change

@codecov-io
Copy link

Codecov Report

Merging #5027 into master will increase coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5027      +/-   ##
==========================================
+ Coverage   60.35%   60.37%   +0.01%     
==========================================
  Files         198      198              
  Lines        6639     6637       -2     
  Branches        4        3       -1     
==========================================
  Hits         4007     4007              
+ Misses       2632     2630       -2
Impacted Files Coverage Δ
packages/jest-util/src/create_process_object.js 100% <ø> (ø) ⬆️
packages/jest-environment-node/src/index.js 76.66% <0%> (ø) ⬆️
packages/jest-environment-jsdom/src/index.js 40% <0%> (ø) ⬆️
packages/jest-config/src/index.js 23.8% <0%> (ø) ⬆️
packages/jest-config/src/normalize.js 92.94% <0%> (+2.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 94101e9...87edaac. Read the comment docs.

@mjesun mjesun merged commit 12f3681 into jestjs:master Dec 6, 2017
@mjesun mjesun deleted the fix-jest-worker-test branch December 6, 2017 15:00
@github-actions
Copy link

This pull request 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants