I\'m trying to mock out a method which takes a long time for testing purposes but can\'t find a good way to do this in Javascript. Any good approaches besides writing a very
function sleep(milliSeconds){
var startTime = new Date().getTime(); // get the current time
while (new Date().getTime() < startTime + milliSeconds); // hog cpu until time's up
}