generator-mocha icon indicating copy to clipboard operation
generator-mocha copied to clipboard

fix(generator): fix tdd option

Open fxleblanc opened this issue 9 years ago • 7 comments
trafficstars

fxleblanc avatar Mar 06 '16 16:03 fxleblanc

cc @eddiemonge

SBoudrias avatar Mar 06 '16 21:03 SBoudrias

I'm conflicted on this. While using the correct language is good, how many people actually use the suite and test syntax?

Also, having diverging templates means having to change both instances when there is a change. In this case, I don't really see that happening a lot, if ever.'

A third point is that it locks the style to TDD or BDD. While running this directly is not a problem, generators that compose on top of this may break if they previously specified QUnit or something else.

eddiemonge avatar Mar 07 '16 18:03 eddiemonge

@eddiemonge I agree, updating the templates is not a good way of doing this. We could always search and replace if tdd is specified.

fxleblanc avatar Mar 07 '16 18:03 fxleblanc

For my part, I always use the bdd way. We could remove the tdd option entirely. It's your call.

fxleblanc avatar Mar 07 '16 18:03 fxleblanc

If it can be done in one template I'd be ok with this

eddiemonge avatar Mar 07 '16 19:03 eddiemonge

I'd either drop the --ui option, or keep two templates. if/else inside templates are the worse to maintain.

SBoudrias avatar Mar 07 '16 19:03 SBoudrias

We could leverage the ejs templates in the test file.

<%= ui.suite %>('suite', function() {
  <%= ui.test %>('test', function(done) {
    assert.ok(true);
  }); 
});

This snippet is theoratical but this is what I have in mind.

fxleblanc avatar Mar 07 '16 19:03 fxleblanc