mercredi 25 novembre 2015

mocha it.each does not work

I tried to test url availability with mocha. To iterate over a list of links I used it-each. I require it as

require('it-each')();

describe('Async loop testing over link list', function () {
        this.timeout(15000);
        it.each(link_list, 'check link %s is available over https(auth)', ['val.title'], function (val, nextVal) {
            var arr = val.url.split(/^(http[s]*:)\/?\/?([^:\/\s]+)(.*)/);
            ///....
            checkPrivateLink("https:", host, path).then(function (res) {
                expect(res.response.statusCode).to.eq(200);
                nextVal();
            }).done(null, nextVal);
        });
});

Now in theory this should work but it does not. It registers one test that is just called 'check link %s is available over https(auth)'. And finishes that test in 0-1 ms, which means it does not actually enter the test loop at all.

Any ideas how to get this working would be much appreciated.

Aucun commentaire:

Enregistrer un commentaire