matchesShardSelection static method
bool
matchesShardSelection(
- String relativePath,
- YamlMap? doc,
- List<
String> arguments, { - EnsembleTestConfig? config,
Implementation
static bool matchesShardSelection(
String relativePath,
YamlMap? doc,
List<String> arguments, {
EnsembleTestConfig? config,
}) {
final ids = valueSet(arguments, '--id');
final features = valueSet(arguments, '--feature');
final profiles = _expandedProfileSelections(
valueSet(arguments, '--profile'),
config,
);
final tags = valueSet(arguments, '--tag');
final paths = valueSet(arguments, '--path');
if (ids.isEmpty &&
features.isEmpty &&
profiles.isEmpty &&
tags.isEmpty &&
paths.isEmpty) {
return true;
}
if (paths.any(relativePath.contains)) return true;
if (doc == null) return false;
final id = doc['id']?.toString();
if (id != null &&
ids.any((selected) => id == selected || selected.startsWith('$id['))) {
return true;
}
if (_scenarioIds(doc).any(ids.contains)) return true;
final feature = doc['feature']?.toString();
if (feature != null && features.contains(feature)) return true;
if (_matchesProfileShardSelection(doc, profiles, config)) return true;
final docTags = _stringList(doc['tags']);
return docTags.any(tags.contains);
}