-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Tests stability improvements #2362
Conversation
…oop followed by an exception
…ull folder otherwise
@@ -41,13 +41,13 @@ export async function run( | |||
const registry = config.registries[registryName]; | |||
const object = rootManifests[registryName].object; | |||
|
|||
for (const type of constants.DEPENDENCY_TYPES) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This construct was crashing node on ubuntu on windows.
I know it is not a good idea to patch Yarn because of a very niche environment but I could not find a nicer workaround
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually this only happens only on Node 7 on ubuntu on windows.
Probably needs to be reported with Node.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'll revert this change and wait for Node to be stable then
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most likely related to nodejs/node#9419
…for-of loop followed by an exception" This reverts commit 68179d0.
} else { | ||
cwd = path.join( | ||
os.tmpdir(), | ||
`yarn-${Math.random()}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does Node.js provide a way to call the system's native temporary directory creation function (such as mkdtemp on GNU/Linux or GetTempFileName on Windows)? The issue with creating temporary directories like this is that two different processes (for example, running different tests in parallel) could generate the same random number.
Failing that, a GUID would be better too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just found that it does support it natively in Nodejs 5.10+: https://nodejs.org/api/fs.html#fs_fs_mkdtemp_prefix_options_callback
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use fs.mkdtemp if available, rather than yarn-${Math.random()}
. The Math.random() could be used as a fallback for old Node.js versions (fs.mkdtemp is only available in Node.js 5 and above).
Yeah, sounds reasonable. |
Actually nodejs/node#6142 makes me think that mdirtmp is quite useless for our case. |
…folder name collisions
@Daniel15, how about now? |
This looks good to me, as Another option is to use something like node-tmp. In any case, feel free to merge this whenever you like :) |
Summary
I am working on Ubuntu on Windows and had to fix a few issues with tests that were broken.
global
tests were failing for non root users