Hei guys,
I'd like to execute this test-cases sequentially with mocha. This means using the result of a previous test for the next one. But how to do that?
describe('some test', function(){
var x;
it('do something', function(done){
x = [10, 20, 30];
done();
});
// dynamic test
x.forEach(function(i){
it('test number '+i, function(done){
setTimeout(function(){
done();
}, 500);
});
});
it('do something else', function(done){
done();
});
});
The current issue is that the forEach is always executed before x being assigned and this raise a Cannot ready property 'forEach' of undefined error.
This is the output I'd like to have:
some test:
- do something
- test number 1
- test number 2
- test number 3
- do something else
Aucun commentaire:
Enregistrer un commentaire