open static method

Future<DirectoryGoldenBundle> open(
  1. String manifestPath, {
  2. String? root,
})

Reads the manifest at manifestPath and takes its goldens from root, which defaults to the goldens/ directory written beside it.

The pairing is the point: a manifest read from one export and goldens read from another produce a suite that measures nothing, so the common case should not require naming two paths.

Implementation

static Future<DirectoryGoldenBundle> open(
  String manifestPath, {
  String? root,
}) async {
  final file = File(manifestPath);
  final manifest = ManifestCodec.decode(await file.readAsString());
  return DirectoryGoldenBundle(
    manifest,
    root: root ?? '${file.parent.path}/goldens',
    bundleRoot: file.parent.path,
  );
}