/    Sign up×
Community /Pin to ProfileBookmark

Does anyone here use a Javascript Code Coverage tool for testing your code?

I’m looking for a javascript code coverage tool that lists the lines of javascript code executed during a user session. I’ve found some, but requires a Windows machine.

Ideally, the coverage tool can be installed as a Firebug plugin to Firefox. Also, I installed the plugin, “Code Coverage v2 for Firebug”, but unfortunately, that no longer works on latest versions of Firefox.

Any ideas would be much appreciated.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@rnd_meAug 13.2012 — firebug's profile tool does that, but it sounds like you want something deploy-able.

you can write a script that wraps all your functions with a wrapper logging function, but that might be over-kill for what you need. try just adding lots of console.log() statements inside the functions you need to log.

if you want to auto-log, there are some simple options.

here's one that i whipped up in firebug:

[CODE]
function addWrapper(fn){
window[fn.name]=function(){
var args=[].slice.call(arguments);
console.log(+new Date+"t"+fn.name +"["+args+"]");
return fn.apply(this, args);

};
}

//usage:

//std functions:
function even(a){ return a%2==0;}
function odd(a){ return a%2!==0;}

//wrapping thos functions:
[even, odd].map(addWrapper);


//running the newly wrapped functions to produce console logs:
[1,2,3,4,5].filter(odd);
[/CODE]
Copy linkTweet thisAlerts:
@anthoangauthorAug 13.2012 — rnd_me,

Thanks. The profiler will be very helpful.


I was looking into stepping-through a javascript framework. More specifically, Sencha ExtJS code - which has over 40,000+ lines of code and it would be crazy to put console.log statements all over the place.
×

Success!

Help @anthoang spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...