mocha pass variable to the next test

Viewed 47690
describe('some test', function(){
    // Could put here a shared variable
    it('should pass a value', function(done){
        done(null, 1);
    });
    it('and then double it', function(value, done){
        console.log(value * 2);
        done();
    });
});

The above currently would not work in mocha.

A solution would be to have a variable shared between the tests, as shown above.

With async.waterfall() this is very possible and I really like it. Is there any way to make it happen in mocha?

Thanks!

3 Answers
Related