Add a reason to a flaky assert (dart-lang/watcher#88)
We have seen a case of this assert failing on linux on travis. Add a
reason which includes the path to hopefully get more information if we
see it again.
diff --git a/pkgs/watcher/test/utils.dart b/pkgs/watcher/test/utils.dart
index fe86407..06d1a12 100644
--- a/pkgs/watcher/test/utils.dart
+++ b/pkgs/watcher/test/utils.dart
@@ -55,12 +55,13 @@
/// If [path] is provided, watches a path in the sandbox with that name.
Future<Null> startWatcher({String path}) async {
mockGetModificationTime((path) {
- path = p.normalize(p.relative(path, from: d.sandbox));
+ final normalized = p.normalize(p.relative(path, from: d.sandbox));
// Make sure we got a path in the sandbox.
- assert(p.isRelative(path) && !path.startsWith('..'));
+ assert(p.isRelative(normalized) && !normalized.startsWith('..'),
+ 'Path is not in the sandbox: $path not in ${d.sandbox}');
- var mtime = _mockFileModificationTimes[path];
+ var mtime = _mockFileModificationTimes[normalized];
return DateTime.fromMillisecondsSinceEpoch(mtime ?? 0);
});