"flutter drive" command
Runs a test app and a driver test simultaneously, then stops the app. Usage: ``` flutter drive --target=/path/to/test/app.dart ``` This command will look for `/path/to/test/app_test.dart` by convention. We will expand into other ways of discovering tests in the future.
This commit is contained in:
@@ -2,14 +2,37 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:file/io.dart';
|
||||
import 'package:file/sync_io.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
|
||||
export 'package:file/io.dart';
|
||||
export 'package:file/sync_io.dart';
|
||||
|
||||
/// Currently active implmenetation of the file system.
|
||||
///
|
||||
/// By default it uses local disk-based implementation. Override this in tests
|
||||
/// with [MemoryFileSystem].
|
||||
FileSystem fs = new LocalFileSystem();
|
||||
SyncFileSystem syncFs = new SyncLocalFileSystem();
|
||||
|
||||
/// Restores [fs] and [syncFs] to the default local disk-based implementation.
|
||||
void restoreFileSystem() {
|
||||
fs = new LocalFileSystem();
|
||||
syncFs = new SyncLocalFileSystem();
|
||||
}
|
||||
|
||||
void useInMemoryFileSystem() {
|
||||
MemoryFileSystem memFs = new MemoryFileSystem();
|
||||
fs = memFs;
|
||||
syncFs = new SyncMemoryFileSystem(backedBy: memFs.storage);
|
||||
}
|
||||
|
||||
/// Create the ancestor directories of a file path if they do not already exist.
|
||||
void ensureDirectoryExists(String filePath) {
|
||||
String dirPath = path.dirname(filePath);
|
||||
if (FileSystemEntity.isDirectorySync(dirPath))
|
||||
|
||||
if (syncFs.type(dirPath) == FileSystemEntityType.DIRECTORY)
|
||||
return;
|
||||
new Directory(dirPath).createSync(recursive: true);
|
||||
syncFs.directory(dirPath).create(recursive: true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user