-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
withPrompts freezes the command line on some windows versions on node 10.2+ #43
Comments
Thanks for reporting this. I wonder if there is anything we can do about this 🤔 |
I did some quick debugging on this and drew the conclusion that the freeze is caused by a step in the yeoman-environment module, though I'm not able to replicate it when using a generator in Windows 7. |
I've just encountered the same issue on Windows 10 after upgrading to Node v10.13.0 recently. The test includes |
Back when I first noticed this node 10.2 was the latest and I found it odd that older versions worked (Including any 10.x prior to 10.2). Do your tests work on 10.1? |
Node 10.1 is used on Windows because of this issue: yeoman/yeoman-test#43
I also faced this. I'm recording here a few of my quick findings (Windows 10/Node 13). So when the generator is ran with this (generator code) class MyGen extends Generator {
constructor(args, opts) {
super(args, opts);
}
public async prompting() {
const qns = [
{
type: "input",
name: "name",
message: "Your project name"
}
];
// working
console.log("before prompting");
// the problem seems to be here..
this.answers = await this.prompt(qns);
// not working
console.log("prompt response resolved");
}
} Looking at the source ( prompt(questions) {
questions = promptSuggestion.prefillQuestions(this._globalConfig, questions);
questions = promptSuggestion.prefillQuestions(this.config, questions);
return this.env.adapter.prompt(questions) // this promise is not resolving
.then(answers => {
if (!this.options['skip-cache'] && !this.options.skipCache) {
promptSuggestion.storeAnswers(this._globalConfig, questions, answers, false);
promptSuggestion.storeAnswers(this.config, questions, answers, true);
}
return answers;
});
} The source of this TestAdapter.prototype.prompt = function(questions, cb) {
/**
* the following line looks like causing an
* un resolved promise.
*/
var promise = this.promptModule(questions);
promise.then(cb || _.noop);
return promise;
}; Everything works fine when Node 8 is used. What is even stranger is when I tried to debug this issue with VS Code Debugger (using jest) with node 10, this worked fine and I couldn't reproduce it. But without debugger this issue is there again. Update: found these tests are passing in GitHub Actions environment (Windows 10/ Node 13). strange. |
@vajahath could get to reproduce this error in GitHub Actions? |
@mshima I couldn't reproduce this at GitHub Actions, which is strange! When I locally run these tests with node 13, it fails and passes at GitHub Actions' environment. |
@vajahath this seems to be a node.js bug that is affecting inquirer SBoudrias/Inquirer.js#767 |
Fixed on inquirer. |
For those who try to use the Inquirer fix, it is reverted because of side effects. See SBoudrias/Inquirer.js#899. |
I didn’t test, but seems to be fixed on node >= 14.6.0. |
This was quite a journey to triage!
Basically if you're running yeoman tests on Appveyor on node 10.2 or higher and you use
withPrompts
in a test the CI will hang indefinitely until it crashes.See example here
And some tests here
If you're running a Windows 10 machine this will not happen locally, but if you run the tests in Windows 7 you'll see that same indefinite freeze that Appveyor fell victim to.
The text was updated successfully, but these errors were encountered: