Can I run Karma Tests with a specified seed?

Viewed 2411

I'm working in an Angular Project that is tested with Karma/Jasmine. Angular tests, by default, run in a randomized order, which may result a test failing if ran in a certain order.

I've noticed that in my browser runner, it displays the randomized seed that the tests were ran with.
When running tests, can I specify this seed, so that I can test the same order more than once? (And so I can pass this seed to others to show in what order their tests fail).

This question is solved, I don't know why it's "Closed. This question needs details or clarity."

1 Answers

You can set random to false in karma config to always get the same order in Jasmine 3.x.

configure jasmine to not run tests randomly

In order for the seed, there is a seed option as well but I am not sure in how to use it. It says it is a function but I see '4321' provided in the second link.

https://github.com/karma-runner/karma-jasmine

Either way, I think specifying random: false should be enough for you because this should be the same order on each run.

Related