I'm trying to loop through some options and build tests based on those options in mocha. I've set up a simple proof of concept for making dynamic tests based roughly on this gist: https://gist.github.com/cybertk/fff8992e12a7655157ed
I keep getting the error: "TypeError: test.retries is not a function" when I run dynamicSuite.addTest(). I cannot figure out what is causing the error. There doesn't seem to be much documentation for this method of building tests in mocha.
Here's the code:
var dynamicSuite = describe('dynamic suite', function() {
this.timeout(10000);
before( function (done) {
var a = ['a', 'b', 'c'];
for(let item of a){
dynamicSuite.addTest(new common.Mocha.Test('test' + item, function(done){
done();
}));
}
done();
});
it('this is needed to make sure tests run', function (done) {
done();
});
after(function(done) {
done();
});
});//end describe test block