jamesknelson / starter-kit

Project boilerplate using React, Redux and Uniloc
http://unicornstandard.com/packages/boilerplate.html
462 stars 42 forks source link

testing with ava and zombie #10

Closed jokeyrhyme closed 8 years ago

jokeyrhyme commented 8 years ago

Would you accept a PR that adds tests using

?

I can see how you might have deliberately avoided tests (because that's how wars start), but I just wanted to check in case it was something you hadn't gotten to, yet.

jamesknelson commented 8 years ago

@jokeyrhyme I hadn't seen these two packages, but I'm interested. Do you have an example somewhere of how the two work together? Also, do you have an example using shallow rendering? I know it isn't strictly necessary with a headless browser, but my opinion so far is that for component unit tests, it seems to be a better way to go.

jokeyrhyme commented 8 years ago

So, ava is very much focused on Node.js tests rather than browser tests (for now). The part of it that I really like is the power-assert compile step: https://github.com/power-assert-js/power-assert

There are babel and webpack plugins for espower, anyhow, and I have been able to integrate espower into the usual mocha + phantomjs test approach.

I've also seen https://www.npmjs.com/package/jsdom-global which is probably even easier to test against compared to phantom and zombie, although jsdom and zombie (which uses jsdom) are arguable a lot less realistic than the headless browser engine in phantom.

jamesknelson commented 8 years ago

Yes - in fact, one of the unicorn standard packages (react-controllable) wasn't possible to test with jsdom due to incompleteness in how it handled events.

If tests are added to this starter kit, I think it would be best to keep the design fairly simple/standard - my preference would be Karma for unit tests, and Nightwatch for integration tests. If you submitted a PR with these, I'd be keen to take a look.

I'll close this for now, but feel free to keep discussing this.