gotwarlost / istanbul

Yet another JS code coverage tool that computes statement, line, function and branch coverage with module loader hooks to transparently add coverage when running tests. Supports all JS coverage use cases including unit tests, server side functional tests and browser tests. Built for scale.
Other
8.7k stars 787 forks source link

[Question] Is there a possibility that instrumentation delays promise .then call? #834

Closed etki closed 7 years ago

etki commented 7 years ago

Hi!

I'm having a rather weird issue. I have a complex setup and a code with a series of promise transformations (and even custom promises/a+ implementation), so i've set a rejectionHandler that would fail my tests if there are unhandled promise rejections anywhere. So far so good, but now i've stumbled upon a situation where rejection happens only when i run tests with coverage (i.e. my library is instrumented). I've eye-traced all promise transformations and all seems (i don't guarantee that, it just seems) that every promise have corresponding instant .then call with rejection handler. So, the question is: is it possible that instrumentation somehow delays .then calls, so rejection handler is installed after Node has already reported about rejection? I'm trying to understand if that's a sign of flaw in my code or just a necessary evil that should be ignored.

etki commented 7 years ago

It is confirmed that problem is inside my code, sorry for the entropy