anchor.diff:        if (dependencies.containsKey(package)) return;
   
         var packagePath;
  -      if (package == 'barback') {
  -        if (_barbackDir == null) {
  -          throw new StateError("createLockFile() can only create a lock file "
  -              "with a barback dependency within a withBarbackVersions() "
  -              "block.");
  -        }
  -        packagePath = _barbackDir;
  +      if (package == 'barback' && _packageOverrides == null) {
  +        throw new StateError("createLockFile() can only create a lock file "
  +            "with a barback dependency within a withBarbackVersions() "
  +            "block.");
  +      }
  +
  +      if (_packageOverrides.containsKey(package)) {
  +        packagePath = _packageOverrides[package];
         } else {
           packagePath = path.join(pkgPath, package);
         }
  
positive.code:   for (var version in validVersions) {
      group("with barback $version", () {
        setUp(() {
          _barbackDir = _barbackVersions[version];
        });
  
        callback();
  
negative.code: Matcher isUnminifiedDart2JSOutput =
      contains("// The code supports the following hooks");
  
  /// A map from package names to paths from which those packages should be loaded
  /// for [createLockFile].
  ///
  /// This allows older versions of dependencies than those that exist in the repo
  /// to be used when testing pub.
  Map<String, String> _packageOverrides;
  
  /// A map from barback versions to the paths of directories in the repo
  /// containing them.
  