parseFile static method
Convenience wrapper that reads a file and calls parse. Adds a
scenario-name ↔ file-path cross-check the byte-only parse cannot
run (it has no path context). Captures placed in _fixtures/
subdirectories are skipped — those are negative-test fixtures with
deliberately unrelated scenarios.
Implementation
static Map<String, Object?> parseFile(File file) {
if (!file.existsSync()) {
throw FormatException('Capture file does not exist: ${file.path}');
}
final metadata = parse(file.readAsBytesSync());
_validateScenarioMatchesPath(file, metadata);
return metadata;
}