Skip to content
Mickael Daniel edited this page Jul 29, 2012 · 1 revision

TOC

# Generators ## yeoman.generators should have a Base object to extend from.
assert.ok(yeoman.generators.Base);

should have a NamedBase object to extend from.

assert.ok(yeoman.generators.NamedBase);
## yeoman.generators.Base should be an EventEmitter.
assert.ok(this.generator instanceof events.EventEmitter);
assert.ok(typeof this.generator.on === 'function');
assert.ok(typeof this.generator.emit === 'function');
this.generator.on('yay-o-man', done);
this.generator.emit('yay-o-man');
## yeoman.generators.NamedBase should be a Base generator.
assert.ok(this.generator instanceof yeoman.generators.Base);

and it should have a name property.

assert.equal(this.generator.name, 'namedArg');
## yeoman.generators.prepare should parse out grunt.cli for arguments and options.
assert.deepEqual(this.generators.args, ['some', 'args']);

should setup the invoked generator name from arguments.

assert.equal(this.generators.name, 'generatorname');

should setup the hash options from grunt.cli.options.

assert.deepEqual(this.generators.options, {
  foo: 'bar',
  bar: 'baz'
});

should prefix each positional arguments with init:.

assert.deepEqual(this.tasks, ['init:yeoman', 'init:generatorname', 'init:some', 'init:args']);

and turn off the internal grunt help output.

assert.equal(this.options.help, false);
assert.equal(typeof this.generators.options.help, 'undefined');
## yeoman.generators.init should setup the current working directory property.
assert.equal(this.generators.cwd, this.cwd);
## yeoman.generators.help ## yeoman.generators.printList ## yeoman.generators.invoke ## yeoman.generators.create ## yeoman.generators.findByNamespace ## yeoman.generators.lookup ## yeoman.generators.lookupHelp ## yeoman.generators.namespacesToPaths
Clone this wiki locally