mardi 2 août 2016

How does Mocha execute the 'it' calls? How to execute tests synchronously?

Observe the following tests:

describe("Testing i", function(){

    var i = 0;
    it('i should be 0', function() {
        expect(i).to.equal(0);
    });

    i++;
    it('i should be 1', function() {
        expect(i).to.equal(1);
    });

    i= 7;
    it('i should be 7', function() {
        expect(i).to.equal(7);
    });
});

The first two tests fail. But I have no idea why! What am I doing wrong?

The test shows the following:

NPM test result using Mocha

Aucun commentaire:

Enregistrer un commentaire