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

Test execution freezes with a NodeJS version >= 10.12.0 #52

Closed
Batta32 opened this issue Feb 8, 2019 · 4 comments
Closed

Test execution freezes with a NodeJS version >= 10.12.0 #52

Batta32 opened this issue Feb 8, 2019 · 4 comments

Comments

@Batta32
Copy link

Batta32 commented Feb 8, 2019

Related issues: #51, feathers-plus/generator-feathers-plus#103, yeoman/generator#1098
Environment: Windows 10, NodeJS >= 10.12.0, mocha 5.2.0

When testing with the yeoman helper, I discovered that by making several hooks' calls to run the generator with prompts, it locks on the same point.

Example:

beforeEach(async function() {
	await helpers.run(path.join(__dirname, '../generators/myGenerator'))
		.inDir(path.join(__dirname, 'tmp'))
		.withPrompts({
			name: 'aName',
			confirmation: true
	});
});

This happens using CMD and PowerShell (what is strange is that in each of them, the execution tests are locked in different points). However, using bash, the execution tests end successfully.

image

Debugging the tests, I found out that the prompting method runs fine and resolves the promise okay.
The problem is that the writing method never runs at the second time that the helpers.run is called inside the beforeEach hook.

Finally, changing the prompts to arguments was the workaround that I found even though is not the final solution I want (this works in all the environments).

Example:

beforeEach(async function() {
	await helpers.run(path.join(__dirname, '../generators/myGenerator'))
	.inDir(path.join(__dirname, 'tmp'))
	.withArguments(['-n', 'aName'])
});

image

@wictorwilen
Copy link

I have the same issue. All 10+ versions of node, on Windows, freezes as soon as I run any test similar to this:

    it('should generate bot project with v1.3 with unit tests', async () => {
        await helpers.run(testHelper.GENERATOR_PATH)
            .inDir(testHelper.TEMP_BOT_GENERATOR_PATH + '/bot01')
            .withArguments(['--no-telemetry'])
            .withPrompts({
                solutionName: 'bot-test-01',
                whichFolder: 'current',
                name: 'bottest01',
                developer: 'generator teams developer',
                manifestVersion: 'v1.3',
                parts: 'bot',
                unitTestsEnabled: true,
            })
            .withGenerators(testHelper.DEPENDENCIES);

})

@SBoudrias - any thoughts?

@Batta32
Copy link
Author

Batta32 commented Jun 26, 2019

Hi @wictorwilen,

We implemented a workaround for this issue in which we evaluated the version of NodeJS before running the tests.

before(  ) {
   if(semver.gte(process.versions.node, `10.12.0`)) {
       run = false;
        
     } else {
        
        //GENERATOR LOGIC
        
      }
}
describe() {
   if(!run) {
       this.skip();
    } 
   
   // TEST LOGIC
   
}

If you want to see the entire code, check here.

@wictorwilen
Copy link

Thanks @Batta32 - it's a good workaround, but it would be great to be able to test on LTS versions of node. Node 8 support ends in only 6 months

@mshima
Copy link
Member

mshima commented Jan 6, 2020

Should be fixed with inquirer 7.0.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants