mmonteleone/pavlov

Given async doesn't propagate arguments

Closed this issue · 1 comments

Good morning!

...and thanks for this wonderful API - it is incredible intuitive. I'm using it to automate the browser interface tests by attaching an invisible iframe to the document body. Certainly better than iMacros, and I dare say Selenium as well as it is fully cross platform and plugin independent. But that's irrelevant, more to the issue

given([[1],[2]]).it("async test", async(function(a) {
    assert(a===1 || a===2).isTrue(); // will fail
    resume();
}));

Now if I'm not wrong, and please let me know if I am, this one-line fix should take care of this bugger, it seems to work too:

async: function(fn) {
    var implementation = function(){
        adapter.pause();
        fn.apply(this, arguments); // changed from fn();
    };
    implementation.async = true;
    return implementation;
},

Thanks, @liquidripples. I've checked in your fix and a corresponding spec.