Tcharl
Tcharl

Reputation: 341

Testing a module

I just implemented a Jhipster module to provide Maven site generation as well as maven release process within Jhipster.

I implemented mocha tests to verify that files are generated (which pass), but it looks like they aren't generated in a real scaffolded context (if you have any clue on the error, I would be really thankful).

The only way I found to test that module with a scaffolded sample is to publish it in the npm registry in order to be able to select it in module choices radio, but it's not really a good option, as it exposes a non working module on the Jhipster marketplace (I'm really sorry about it).

Upvotes: 1

Views: 52

Answers (1)

Jon Ruddell
Jon Ruddell

Reputation: 6362

To test a module locally, do the following:

  • run npm link in your module directory
  • generate a project
  • run npm link generator-jhipster-enterprise-pom in your project

Now when you run yo jhipster-enterprise-pom it will use your local code instead of requiring installation from npmjs.

Looking at your module's code, it looks like you renamed the app folder to server. A yeoman generator runs the code found in the app folder which is why your local test is failing. According to the Writing Your Own Yeoman Generator docs:

The default generator used when you call yo name is the app generator. This must be contained within the app/ directory.

It's currently accessible by running yo jhipster-enterprise-pom:server but I imagine you don't want the :server included in the default command.

Upvotes: 3

Related Questions