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: return correct type from process.send stub #11799

Merged
merged 3 commits into from Sep 9, 2021
Merged

Conversation

vladar
Copy link
Contributor

@vladar vladar commented Aug 30, 2021

Summary

The process.send stub created by Jest always returns undefined but Node actually always returns boolean value from process.send (see types 1 and 2, as well as Node docs)

By default, it returns true and only returns false when the IPC message is buffered or the child process had already exited, see related docs on child_process.

Current behavior of Jest stub causes quirks when user code actually checks for returned values (e.g. to implement backpressure for IPC calls)

Test plan

Not sure how to actually test it. I don't see existing tests for this feature in the original PR #5904

@SimenB
Copy link
Member

SimenB commented Sep 1, 2021

@vladar closed on purpose?

@vladar
Copy link
Contributor Author

vladar commented Sep 1, 2021

@SimenB No, looks like GitHub autoclosed it because the referenced PR in gatsby repo had this piece in the description: proposed fix: facebook/jest#11799 😄

@vladar vladar reopened this Sep 1, 2021
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.

looks fine to me - mind adding a changelog entry as well?

@vladar
Copy link
Contributor Author

vladar commented Sep 1, 2021

Done ✅ Let me know if something needs to be changed

@codecov-commenter
Copy link

Codecov Report

Merging #11799 (5a6d3db) into master (98f10e6) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #11799   +/-   ##
=======================================
  Coverage   69.04%   69.04%           
=======================================
  Files         312      312           
  Lines       16366    16366           
  Branches     4746     4746           
=======================================
  Hits        11300    11300           
  Misses       5039     5039           
  Partials       27       27           
Impacted Files Coverage Δ
packages/jest-util/src/createProcessObject.ts 83.63% <100.00%> (ø)

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 98f10e6...5a6d3db. Read the comment docs.

@SimenB SimenB merged commit ae990f0 into jestjs:main Sep 9, 2021
@SimenB
Copy link
Member

SimenB commented Sep 13, 2021

@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 Oct 14, 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.

None yet

4 participants