Skip to content

Commit

Permalink
Make testRandomizeOrderingSeed public on Engine (#1543)
Browse files Browse the repository at this point in the history
One internal reporter needs this information.

Use a consistent name for the constructor argument assign in argument list.
  • Loading branch information
natebosch authored Jun 17, 2021
1 parent a645110 commit eb1155c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pkgs/test_core/lib/src/runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class Runner {
var engine = Engine(
concurrency: config.concurrency,
coverage: config.coverage,
randomizeOrderingSeed: config.testRandomizeOrderingSeed);
testRandomizeOrderingSeed: config.testRandomizeOrderingSeed);

var sinks = <IOSink>[];
Reporter createFileReporter(String reporterName, String filepath) {
Expand Down
13 changes: 6 additions & 7 deletions pkgs/test_core/lib/src/runner/engine.dart
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class Engine {
///
/// If null or zero no shuffling will occur.
/// The same seed will shuffle the tests in the same way every time.
int? _testRandomizeOrderingSeed;
int? testRandomizeOrderingSeed;

/// A pool that limits the number of test suites running concurrently.
final Pool _runPool;
Expand Down Expand Up @@ -204,10 +204,9 @@ class Engine {
///
/// [concurrency] controls how many suites are loaded and ran at once, and
/// defaults to 1.
Engine({int? concurrency, String? coverage, int? randomizeOrderingSeed})
Engine({int? concurrency, String? coverage, this.testRandomizeOrderingSeed})
: _runPool = Pool(concurrency ?? 1),
_coverage = coverage,
_testRandomizeOrderingSeed = randomizeOrderingSeed {
_coverage = coverage {
_group.future.then((_) {
_onTestStartedGroup.close();
_onSuiteStartedController.close();
Expand Down Expand Up @@ -308,9 +307,9 @@ class Engine {
if (!_closed && setUpAllSucceeded) {
// shuffle the group entries
var entries = group.entries.toList();
if (_testRandomizeOrderingSeed != null &&
_testRandomizeOrderingSeed! > 0) {
entries.shuffle(Random(_testRandomizeOrderingSeed));
if (testRandomizeOrderingSeed != null &&
testRandomizeOrderingSeed! > 0) {
entries.shuffle(Random(testRandomizeOrderingSeed));
}

for (var entry in entries) {
Expand Down

0 comments on commit eb1155c

Please sign in to comment.