Skip to content

Commit

Permalink
handle missing package config files (#2158)
Browse files Browse the repository at this point in the history
  • Loading branch information
jakemac53 authored Dec 13, 2023
1 parent 9667cca commit 15b3937
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pkgs/test_core/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.6.1-wip

- Handle missing package configs.

## 0.6.0

* Handle paths with leading `/` when spawning test isolates.
Expand Down
9 changes: 7 additions & 2 deletions pkgs/test_core/lib/src/util/package_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ Future<Uri> absoluteUri(String path) async {
final uri = p.toUri(path);
final absoluteUri =
uri.isAbsolute ? uri : _originalWorkingDirectory.resolveUri(uri);
final packageConfig = await currentPackageConfig;
return packageConfig.toPackageUri(absoluteUri) ?? absoluteUri;
try {
final packageConfig = await currentPackageConfig;
return packageConfig.toPackageUri(absoluteUri) ?? absoluteUri;
} on StateError catch (_) {
// Workaround for a missing package config.
return absoluteUri;
}
}
2 changes: 1 addition & 1 deletion pkgs/test_core/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_core
version: 0.6.0
version: 0.6.1-wip
description: A basic library for writing tests and running them on the VM.
repository: https://github.com/dart-lang/test/tree/master/pkgs/test_core

Expand Down

0 comments on commit 15b3937

Please sign in to comment.