mardi 5 mai 2015

Is jasmine supposed to execute specs in the order they are declared or in a random order?

As a test I put together following suite. Jasmine appears to run the specs in the order they are declared- all assertions pass:

describe('test', function() {
  var index = 0;

  it('test 0', function() {
    expect(index).toBe(0);
    index++;
  });

  it('test 1', function(done) {
    expect(index).toBe(1);
    index++;
    done();
  });

  it('test 2', function() {
    expect(index).toBe(2);
    index++;
  });

  it('test 3', function() {
    expect(index).toBe(3);
    index++;
  });

  it('test 4', function() {
    expect(index).toBe(4);
    index++;
  });
});

I have another "real" suite where this is not the case. Jasmine seems to be running the specs in random order and I can't find documentation anywhere that says whether this is the expected behavior or not.

Aucun commentaire:

Enregistrer un commentaire