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

chore: use createDirectory from jest-util when creating directories #7610

Merged
merged 5 commits into from
Jan 16, 2019

Conversation

SimenB
Copy link
Member

@SimenB SimenB commented Jan 11, 2019

Summary

After landing #7408, jest-worker will use worker_threads if they are available (behind a flag in node 10 & 11, unflagged in Node 12). However, running Jest's own integration tests in a worker currently fails with TypeError: process.umask is not a function

If you do not provide a mode to mkdir, it uses process.umask (https://github.com/substack/node-mkdirp/blob/f2003bbcffa80f8c9744579fabab1212fc84545a/index.js#L64) which throws that error.

See https://nodejs.org/api/worker_threads.html#worker_threads_class_worker

process.chdir() and process methods that set group or user ids are not available.

createDirectory in jest-util passes 777 as mode (same as node's own fs.mkdir does), so it works perfectly fine in a worker

This is just changing internal stuff, so no changelog.

Test plan

Ran tests locally with workers after the change

Copy link
Member

@rickhanlonii rickhanlonii left a comment

Choose a reason for hiding this comment

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

LGTM! Should we add node 10 + experimentalWorker to circle?

@SimenB
Copy link
Member Author

SimenB commented Jan 11, 2019

Yeah, we can do that.

Copy link
Contributor

@jeysal jeysal left a comment

Choose a reason for hiding this comment

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

Mind also extracting createDirectory from jest-util's index.js to its own file while at it?
That being in there already bugged me when I added specialChars recently 😄

@SimenB
Copy link
Member Author

SimenB commented Jan 11, 2019

Yeah, can do that as well

@SimenB
Copy link
Member Author

SimenB commented Jan 11, 2019

Added the worker build, hopefully it passes 🤞

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

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

Well played

@SimenB
Copy link
Member Author

SimenB commented Jan 11, 2019

It's failing... @rickhanlonii something you could look into? Seems like the coverage doesn't pick up uncovered files, as well as some other stuff

@SimenB SimenB merged commit 418d784 into jestjs:master Jan 16, 2019
@SimenB SimenB deleted the create-directory-mode branch January 16, 2019 07:23
@SimenB
Copy link
Member Author

SimenB commented Jan 16, 2019

Moved the worker CI run to #7637

@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 12, 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