Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkgs/watcher/test/directory_watcher/file_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.

import 'dart:io' as io;
import 'dart:io';
import 'dart:isolate';

import 'package:test/test.dart';
Expand All @@ -18,6 +19,21 @@ void fileTests({required bool isNative}) {
}

void _fileTests({required bool isNative}) {
test('error reported if directory does not exist', () async {
await startWatcher(path: 'missing_path');

// TODO(davidmorgan): reconcile differences.
if (isNative && !Platform.isMacOS) {
expect(expectNoEvents, throwsA(isA<PathNotFoundException>()));
} else {
// The polling watcher and the MacOS watcher do not throw on missing file
// on watch.
await expectNoEvents();
writeFile('missing_path/file.txt');
await expectAddEvent('missing_path/file.txt');
}
});

test('does not notify for files that already exist when started', () async {
// Make some pre-existing files.
writeFile('a.txt');
Expand Down