bahmutov / lazy-ass

Lazy node assertions without performance penalty
http://glebbahmutov.com/lazy-ass/
MIT License
68 stars 5 forks source link

Custom assessment output #18

Open nikravi opened 8 years ago

nikravi commented 8 years ago

Hi Gleb,

We totally love this utility, and we've come up to use for our protractor tests runner (nodejs environment). The issue is that in the newest Protractor, throwing an error will stop the testing. We want to continue, and we'll get all the reporting after. Is it possible to configure lazyAss to call a function, instead of

throw err;output(err)

The default should be kept as is (throwing errors), and in some cases we want to do console.log or any other output stream we'll come up with.

Thanks!

bahmutov commented 8 years ago

Is there no flag for Protractor to continue even if a test fails or an error is thrown?

nikravi commented 8 years ago

I guess no, it's actually in Jasmine. What we really want to fix is to get the detailed 'expect' message, this issue is still not fixed https://github.com/jasmine/jasmine/issues/641. Our workaround is like this: first expect, then check with lazy-ass the same condition.

            expect(text.indexOf(expectedText)).toBeGreaterThan(-1);
            la(index > -1, 'expected', text, 'to contain', expectedText);

Would be nice if lazy-ass could output it's parsing, then we can create a PR to jasmine using it.