DISQUS

Life is grand: Javascript code coverage MIA

  • James Mernin · 3 years ago
    I'm hearing some rumblings too that a similar problem exists with J2ME code coverage tools. Apparently, there is an extension to Cobertura but it does not work correctly (yet).
  • Andy Peace · 3 years ago
    Since JavaScript has closures, I think it's impossible to compute (though may be wrong). You could do it dynamically (i.e. run the scripts for a long time and see what happens) but it's not guaranteed to be correct. You could also get a conservative approximation using standard algorithms.
  • Paul Watson · 3 years ago
    How does JavaScript having closures preclude it from code coverage analysis? Ruby has closures and it has some decent code coverage tools.

    AFAIK most CC tools inject traces into the code and then run the tests, so computing what gets run and what does not.
  • Andy Peace · 3 years ago
    Ah I see. It precludes you from determining the answer statically, is all I meant (i.e. you can't just have a tool that looks at the code and figures it out). It can of course do it in the way you describe.
  • Brian W · 3 years ago
    This doesn't help you with your Javascript problem but Cobertura4J2ME does work quite well now on mobile java code.
  • Stephen Kellett · 2 years ago
    JavaScript Coverage Validator left beta in late October.

    http://www.softwareverify.com/news.html

    Added Firefox 2 support in November

    http://www.softwareverify.com/blog/

    Stephen