Last active
March 10, 2022 20:57
-
-
Save odlp/e1586f4f198d157de50e8303b18acfd9 to your computer and use it in GitHub Desktop.
Jasmine / Karma seed reporter for random test order
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
} | |
} | |
} |
@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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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