tmcgee123/karma-spec-reporter

I would like the seed to be printed out

Closed this issue · 3 comments

I would like the seed that is used for randomizing the tests to be printed out.

If I use random: true configuration option for jasmine and do not provide my own seed , the seed gets generated. I would like to know what that seed is, so that I could rerun my tests with that seed, i.e. in the same exact order.

I am trying to troubleshoot several tests that are failing randomly depending on the execution order.

Thank you.

Interesting, I've not learned about seeds in unit testing, the reporter should definitely support jasmine as much as possible.

Traditionally, I was taught that tests should be written in a manner that they could be executed in any order, so being able to identify when this happens seems very important.

I found this: https://gist.github.com/odlp/e1586f4f198d157de50e8303b18acfd9

All it does is output the seed at the end of the process, as such:
this.write("%s: Randomized with seed %s\n", browser, result.order.seed);

Do you think this would suffice?

Thanks for the help!

@oklymenk , @tmcgee123
I've made a separate npm package karma-jasmine-order-reporter.
Plugin in karma-jasmine-order-reporter emits seed number at start and end of Jasmine spec run unlike reporter in gist emitting on browserComplete which may not occur if Karma crashes.

Closing as another package was made