This question is a few months old, but I think it is useful for those who find it now to find out, which has been much more explained in http://yeoman.io/generators.html
Question 1:
Testing your generators locally can be easily done. For example, if your generator is called "mtv-raps generator"
$ cd ~/dev/generator-mtv-raps/ $ npm link
Now if you do:
$ cd ~/dev/mytest/ $ yo mtv-raps
It will be created.
In addition, the test unit for your wet mocha generator is pretty simple. There is a built-in set of test assistants. The basics of what you need to test can be found in the generator-webapp tests https://github.com/yeoman/generator-webapp/blob/master/test/test.js
- Verify that the generator may be required without breaking.
- Mark your invitations with
helpers.mockPrompt - Verify that all the files you want to create are created using
helpers.assertFiles - Test that the values you are mocking are inserted into the created files.
The number 4 is quite complex; an array of expected files can be passed a regular expression for validation. If you want to know more about test assistants, the source is the best place. https://github.com/yeoman/generator/blob/master/lib/test/helpers.js
Question 2: btford already answered
Question 3:
Generators are tied to yo , installing them globally (or binding them as described above) and using a naming convention. All generators start with "generator", then "-", then "name".
hence generator-mtv-raps is available through $ yo mtv-raps
source share