File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed
pkgs/watcher/test/directory_watcher Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change 33// BSD-style license that can be found in the LICENSE file.
44
55import 'dart:io' as io;
6+ import 'dart:io' ;
67import 'dart:isolate' ;
78
89import 'package:test/test.dart' ;
@@ -18,6 +19,21 @@ void fileTests({required bool isNative}) {
1819}
1920
2021void _fileTests ({required bool isNative}) {
22+ test ('error reported if directory does not exist' , () async {
23+ await startWatcher (path: 'missing_path' );
24+
25+ // TODO(davidmorgan): reconcile differences.
26+ if (isNative && ! Platform .isMacOS) {
27+ expect (expectNoEvents, throwsA (isA <PathNotFoundException >()));
28+ } else {
29+ // The polling watcher and the MacOS watcher do not throw on missing file
30+ // on watch.
31+ await expectNoEvents ();
32+ writeFile ('missing_path/file.txt' );
33+ await expectAddEvent ('missing_path/file.txt' );
34+ }
35+ });
36+
2137 test ('does not notify for files that already exist when started' , () async {
2238 // Make some pre-existing files.
2339 writeFile ('a.txt' );
You can’t perform that action at this time.
0 commit comments