parseConfigString static method

EnsembleTestConfig parseConfigString(
  1. String content, {
  2. String? sourcePath,
})

Parses one suite tests/config.yaml document from content.

Implementation

static EnsembleTestConfig parseConfigString(
  String content, {
  String? sourcePath,
}) {
  if (content.trim().isEmpty) return const EnsembleTestConfig();
  final dynamic doc = loadYaml(content);
  if (doc == null) return const EnsembleTestConfig();
  if (doc is! YamlMap) {
    throw EnsembleTestFailure(
      'Invalid test config${sourcePath != null ? ' ($sourcePath)' : ''}: root must be a map',
    );
  }
  return _parseConfig(doc);
}