-
-
Save odlp/e1586f4f198d157de50e8303b18acfd9 to your computer and use it in GitHub Desktop.
var SeedReporter = function(baseReporterDecorator) { | |
baseReporterDecorator(this); | |
this.onBrowserComplete = function(browser, result) { | |
if (result.order && result.order.random && result.order.seed) { | |
this.write("%s: Randomized with seed %s\n", browser, result.order.seed); | |
} | |
}; | |
}; | |
module.exports = { | |
"reporter:jasmine-seed": ["type", SeedReporter] | |
}; |
const jasmineSeedReporter = require("./spec/javascript/support/jasmine_seed_reporter.js") | |
module.exports = function(config) { | |
// abridged | |
plugins: [ | |
"karma-*", | |
jasmineSeedReporter | |
], | |
reporters: ["progress", "jasmine-seed"], | |
client: { | |
jasmine: { | |
random: true | |
// seed: 1234 // Specify if you need to re-run the same seed | |
} | |
} | |
} |
Good job guys! ๐ Just note that it was failing for me because seed value should be a string.
Hi, thanks for this solution ๐
By the way i found what logs is duplicate with this reporter and fix it add stub for onBrowserLog
. Maybe it help somebody else.
const SeedReporter = function(baseReporterDecorator) {
baseReporterDecorator(this);
this.onBrowserLog = function(browser, log, type) {
// For prevent log duplicate.
};
...
};
Thanks @Furg - that comment saved me hours...
Is there a way to print the seed before the tests start? We have a specific issue where an error is thrown in the after all and therefore throwing the error all the way up it seems. So since the tests can't complete I don't get the seed value to replicate.
@douglasrlee - I haven't tried it, but this reporter seems to print the seed before & after the spec run which might help you: https://github.com/dmitryshindin/karma-jasmine-order-reporter
@douglasrlee - I haven't tried it, but this reporter seems to print the seed before & after the spec run which might help you: https://github.com/dmitryshindin/karma-jasmine-order-reporter
Almost worked, but I had to do some changes to this karma.conf.js example:
then it worked for me.
thanks