jhipster / generator-jhipster

JHipster is a development platform to quickly generate, develop, & deploy modern web applications & microservice architectures.
https://www.jhipster.tech
Apache License 2.0
21.56k stars 4.02k forks source link

Enable unit testing of blueprints #8364

Closed murdos closed 6 years ago

murdos commented 6 years ago
Overview of the feature request

Allow writing unit tests with yeoman-test when developing blueprints, invoking the main JHipster subgenerator while loading the blueprint subgenerator using .withGenerators(...).

Motivation for or Use Case

Writing such test in blueprint module currently doesn't work:

describe('JHipster server generator with blueprint', () => {
    describe('generate server', () => {
        beforeEach((done) => {
            helpers.run('generator-jhipster/generators/server')
                .withOptions({blueprint: 'generator-jhipster-myblueprint'})
                .withGenerators(
                     [path.join(__dirname, '../generators/server') // <== blueprint generator
                ]) 
                .withPrompts({
                    /* ... */
                })
                .on('end', done);
        });
    });
});

You end up with an error:

The generator-jhipster-myblueprint blueprint provided is not installed. Please install it using command npm i -g generator-jhipster-myblueprint.
Related issues or PR

None that I know.

jdubois commented 6 years ago

@deepu105 bounty added :-)

deepu105 commented 6 years ago

@murdos please dont forget to claim your bounty