-
Notifications
You must be signed in to change notification settings - Fork 29.8k
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
10.7.0 broke the Yarn tests #21907
Comments
@arcanis This does not look to be observed when run without the mock from https://github.com/yarnpkg/yarn/blob/master/__tests__/__mocks__/request.js. |
A reproducable testcase without all the other const request = require('request');
const https = require('https');
const fs = require('fs');
const opt = {"url":"https://registry.yarnpkg.com/yeoman-environment","method":"GET","headers":{"User-Agent":"yarn/1.10.0-0 npm/? node/v10.7.0 linux x64","Accept":"application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*"},"json":true,"gzip":true,"forever":true,"retryAttempts":0,"strictSSL":true,"cert":"","key":"","timeout":30000};
const req = request(opt, () => {});
req.httpModule = {
request: function request(options, callback) {
const loc = 'yeoman-environment.bin';
options.agent = null;
options.socketPath = null;
options.createConnection = () => {
return fs.createReadStream(loc);
};
return https.request(options, callback);
}
}; This is basically what Yarn does. |
You're right, seems like this is caused in particular by the mock of options.createConnection = (): ReadStream => {
return fs.createReadStream(loc);
}; The previous code was attaching on the I think this is on Yarn, so I'm going to close this issue. Feel free to reopen if you think it hides a more problematic regression. |
And thanks for your help, greatly appreciated! |
If it's the mock, my guess is that it is due to
|
Wow a lot of conversation happened while I was posted that :) disregard |
@arcanis This is one of the reasons why trying to keep the reproducable testcases minimal matters. I attempted to construct a testcase without yarn. To trace that, I noticed that the error was coming from the --- node_modules/request/request.js
***************
*** 93,94 ****
--- 93,96 ----
function Request (options) {
+ console.log('Request', JSON.stringify(options));
+ console.log((new Error()).stack)
// if given the method property in options, set property explicitMethod to true That brought me directly to the mock file (and gave the short testcase in the comment above). Hope that helps 😉. |
Yeah, I actually logged the options to try to make repros, but completely forgot we mocked request, so didn't check the stack 😐 |
Related: There's a PR to get |
@ChALkeR little debugging tip: instead of the double |
The 10.7.0 release is causing the Yarn test suite to fail (which prevents us from releasing the 1.9, but also might cause issues with everyone already using Yarn), something related to timeouts:
A single commit has been pushed to this file between the 10.6.0 and the 10.7.0 and it happens to change the timeout behavior, which would be consistent with the reported error: 949e885 (cc @killagu).
The repro: clone [email protected]:yarnpkg/yarn and run:
I realize it's not a great repro, I'm still working on finding a shorter one.
The text was updated successfully, but these errors were encountered: