Description
Is your feature request related to a problem? Please describe.
Jest calls mkdirp
during its unit tests. Jest has also recently added support for worker_threads
. However, when I wanted to try it out, hundreds of tests failed with TypeError: process.umask is not a function
It turn out mkdirp
uses process.umask()
if no mode
is provided: https://github.com/substack/node-mkdirp/blob/f2003bbcffa80f8c9744579fabab1212fc84545a/index.js#L64
I've since found that this function missing in worker_threads
is well documented: https://nodejs.org/api/worker_threads.html#worker_threads_class_worker
process.chdir()
andprocess
methods that set group or user ids are not available.
Describe the solution you'd like
If node could throw "process.umask
is not available in worker threads" or similar it would have made my debugging way easier, rather than the function just be missing.
I'm not sure how that would play with typeof process.umask === 'function'
checks people might have?
Describe alternatives you've considered
My solution was to pass 777
as mode explicitly to mkdirp
, but a clearer error would have made the debugging way easier.
My use case might be a bit special since Jest reconstructs a fake process
object for every single test (by inspecting the real one), so my rabbit hole before checking worker docs were probably deeper than most people in the same situation. I was also testing node 12 (where threads are unflagged), so I wasn't even aware I was running in threads at first.