[flutter_plugin_tools] Remove global state from tests (#4018)

Eliminates the global test filesystem and global test packages directory, in favor of local versions. This guarantees that each test runs with a clean filesystem state, rather than relying on cleanup. It also simplifies understanding the tests, since everything is done via params and return values instead of needing to know about the magic global variables and which methods mutate them.
This commit is contained in:
stuartmorgan
2021-06-07 10:04:43 -07:00
committed by GitHub
parent bb0a1ea161
commit 74d03857f8
16 changed files with 456 additions and 537 deletions

View File

@ -43,9 +43,9 @@ void main() {
});
test('pubspec includes all plugins', () async {
createFakePlugin('plugina', packagesDirectory: packagesDir);
createFakePlugin('pluginb', packagesDirectory: packagesDir);
createFakePlugin('pluginc', packagesDirectory: packagesDir);
createFakePlugin('plugina', packagesDir);
createFakePlugin('pluginb', packagesDir);
createFakePlugin('pluginc', packagesDir);
await runner.run(<String>['all-plugins-app']);
final List<String> pubspec =
@ -61,9 +61,9 @@ void main() {
});
test('pubspec has overrides for all plugins', () async {
createFakePlugin('plugina', packagesDirectory: packagesDir);
createFakePlugin('pluginb', packagesDirectory: packagesDir);
createFakePlugin('pluginc', packagesDirectory: packagesDir);
createFakePlugin('plugina', packagesDir);
createFakePlugin('pluginb', packagesDir);
createFakePlugin('pluginc', packagesDir);
await runner.run(<String>['all-plugins-app']);
final List<String> pubspec =
@ -80,7 +80,7 @@ void main() {
});
test('pubspec is compatible with null-safe app code', () async {
createFakePlugin('plugina', packagesDirectory: packagesDir);
createFakePlugin('plugina', packagesDir);
await runner.run(<String>['all-plugins-app']);
final String pubspec =