10up / generator-wp-make

A Yeoman generator for making WordPress things
184 stars 42 forks source link

Mocha/Chai for JavaScript testing #64

Closed allenmoore closed 8 years ago

allenmoore commented 8 years ago

The pull request adds both Mocha.js and Chai.js for JavaScript testing. Developers have two options to run a mocha test:

  1. Run the grunt cli commands: grunt mocha or grunt test.
  2. Run in browser at local.dev/path/to/tests/mocha/file-name.html.
lkwdwrd commented 8 years ago

Looks pretty good!

One suggestion -- if we go with Mocha, I'd rather just cut over to it completely and pull out qunit, or is there do you feel there is a good reason not to do that?

allenmoore commented 8 years ago

Hey @lkwdwrd,

If we go with Mocha, I would completely pull out QUnit. Since both are serving the same purpose, it would seem pointless to have to maintain both. Also, Mocha is specified in the 10up Engineering Best Practices as what we use for testing -- https://10up.github.io/Engineering-Best-Practices/javascript/#unit-and-integration-testing, so it would seem fitting for it be a part of the generator. What are your thoughts?

lkwdwrd commented 8 years ago

Completely agree, which is why I was asking. Still saw a bunch of qunit in your PR :-)

allenmoore commented 8 years ago

What? I don't see QUnit anywhere...now that I've completely removed it. ;)

allenmoore commented 8 years ago

@ericmann Yeah, that could present some potential issues. PHP files removed.