nathanboktae / mocha-casperjs

Write CasperJS tests using Mocha
MIT License
120 stars 29 forks source link

Experimenting with catching multiple errors in a test #56

Closed thekevinscott closed 9 years ago

nathanboktae commented 9 years ago

Also can you add a test case from #56 ?

thekevinscott commented 9 years ago

Added a test case for the cascading errors and renamed to stepErrors

thekevinscott commented 9 years ago

IIRC casper doesn't work well calling casper.run multiple times. rather the reporting of the error should be moved down to the main done() call on (current) line 100.

I'm having trouble implementing this. As far as I understand it, by the time we're here we've already got the next test and its done function, so any subsequent errors clobber the wrong test.

I'm down for moving calls to casper.run out of failTest but not really sure how to maintain a pointer to the current test object without calling it from failTest.

nathanboktae commented 9 years ago

hmm do you want to use your version in your company's test suite for a bit and let me know how it goes? I will take a crack at this in the next few days. I switched jobs so I currently don't have a real test suite to party on as of yet.

thekevinscott commented 9 years ago

We should not be mucking with this. I want to keep the muddling we do with casper's internal state to a minimum.

I hear ya. It's definitely a bit hacky, but otherwise waitFor errors end up hanging indefinitely.

hmm do you want to use your version in your company's test suite for a bit and let me know how it goes? I will take a crack at this in the next few days. I switched jobs so I currently don't have a real test suite to party on as of yet.

Sounds good, I'm happy to keep experimenting. I assume there's probably a better way to implement this that doesn't rely on mucking with Casper directly but I'm not so familiar with the internals so hopefully you'll have some bright ideas :)