Skip to content

Commit

Permalink
Merge branch 'main' into enan/remove-legacy
Browse files Browse the repository at this point in the history
  • Loading branch information
renancaraujo committed Mar 23, 2023
2 parents fc9a669 + 351b8cc commit 805c454
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/workflows/very_good_cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ jobs:
- test/src/commands/create/e2e/docs_site/docs_site_test.dart
- test/src/commands/create/e2e/flame_game/flame_game_test.dart
- test/src/commands/create/e2e/flutter_package/flutter_pkg_test.dart
- test/src/commands/create/e2e/flutter_plugin/flutter_plugin_test.dart

steps:
- name: 馃摎 Git Checkout
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import '../../../../../helpers/helpers.dart';
void main() {
test(
'create flame_game',
timeout: const Timeout(Duration(minutes: 5)),
withRunner((commandRunner, logger, updater, logs) async {
final directory = Directory.systemTemp.createTempSync();

Expand Down Expand Up @@ -64,6 +65,5 @@ void main() {
expect(testCoverageResult.stderr, isEmpty);
expect(testCoverageResult.stdout, contains('lines......: 97.8%'));
}),
timeout: const Timeout(Duration(minutes: 2)),
);
}
102 changes: 102 additions & 0 deletions test/src/commands/create/e2e/flutter_plugin/flutter_plugin_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
@Tags(['e2e'])
library flutter_plugin_test;

import 'package:mason/mason.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';
import 'package:universal_io/io.dart';

import '../../../../../helpers/helpers.dart';

void main() {
test(
'create flutter_plugin',
timeout: const Timeout(Duration(minutes: 8)),
withRunner((commandRunner, logger, updater, logs) async {
final directory = Directory.systemTemp.createTempSync();
const pluginName = 'very_good';
final pluginDirectory = path.join(directory.path, pluginName);

final result = await commandRunner.run(
['create', 'flutter_plugin', pluginName, '-o', directory.path],
);
expect(
result,
equals(ExitCode.success.code),
reason: '`very_good create flutter_plugin` failed with $result',
);

final formatResult = await Process.run(
'dart',
['format', '.'],
workingDirectory: pluginDirectory,
runInShell: true,
);
expect(
formatResult.exitCode,
equals(ExitCode.success.code),
reason: '`dart format` failed with ${formatResult.stderr}',
);
expect(formatResult.stderr, isEmpty);

final analyzeResult = await Process.run(
'flutter',
['analyze', '.'],
workingDirectory: pluginDirectory,
runInShell: true,
);
expect(
analyzeResult.exitCode,
equals(ExitCode.success.code),
reason: '`flutter analyze` failed with ${analyzeResult.stderr}',
);
expect(analyzeResult.stderr, isEmpty);
expect(analyzeResult.stdout, contains('No issues found!'));

final packageDirectories = [
path.join(pluginDirectory, pluginName),
path.join(pluginDirectory, '${pluginName}_android'),
path.join(pluginDirectory, '${pluginName}_ios'),
path.join(pluginDirectory, '${pluginName}_linux'),
path.join(pluginDirectory, '${pluginName}_macos'),
path.join(pluginDirectory, '${pluginName}_web'),
path.join(pluginDirectory, '${pluginName}_windows'),
path.join(pluginDirectory, '${pluginName}_platform_interface'),
];

for (final packageDirectory in packageDirectories) {
final testResult = await Process.run(
'flutter',
['test', '--no-pub', '--coverage', '--reporter', 'compact'],
workingDirectory: packageDirectory,
runInShell: true,
);
expect(
testResult.exitCode,
equals(ExitCode.success.code),
reason:
'''`flutter test` in $packageDirectory failed with ${testResult.stderr}''',
);
expect(testResult.stderr, isEmpty);
expect(testResult.stdout, contains('All tests passed!'));

final testCoverageResult = await Process.run(
'genhtml',
['coverage/lcov.info', '-o', 'coverage'],
workingDirectory: packageDirectory,
runInShell: true,
);
expect(
testCoverageResult.exitCode,
equals(ExitCode.success.code),
reason:
'''`genhtml` in $packageDirectory failed with ${testCoverageResult.stderr}''',
);
expect(testCoverageResult.stderr, isEmpty);
expect(testCoverageResult.stdout, contains('lines......: 100.0%'));
}

directory.deleteSync(recursive: true);
}),
);
}

0 comments on commit 805c454

Please sign in to comment.