I believe it is considered to be a bad practice to rely on the order in which the (acceptance) tests should be run, but for testing "deeply nested features" (I don't know if there is a standard term for that) it might help to save time (I mean to save the time of repeating the same set of operations before each test; what I have in mind are actually Protractor tests).

So my question is whether there is a standard reliable way to fix the order in which Jasmine tests are perfomed.

2 Answers 2


On Jasmine 3.x, random order is the default behavior.

To run in order file written order, you can specify --random=false or use a seed.

Docs: https://jasmine.github.io/api/3.3/Configuration.html

  • 1
    This is super helpful. I was wondering why my tests are failing and thought random ordering is the reason. Thank you.
    – Arefe
    Aug 18, 2021 at 13:35

You can edit the karma.config file to change the default randomization to false. I got the answer from the following blog: https://www.miguoliang.com/how-to-fix-testing-order-in-angular-with-jasmine.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.