diff --git a/.github/workflows/e2e.yaml b/.github/workflows/e2e.yaml index b3164e7c4..bb866595d 100644 --- a/.github/workflows/e2e.yaml +++ b/.github/workflows/e2e.yaml @@ -21,7 +21,6 @@ on: jobs: e2e: runs-on: ubuntu-latest - strategy: matrix: test: diff --git a/bricks/test_optimizer/hooks/lib/pre_gen.dart b/bricks/test_optimizer/hooks/lib/pre_gen.dart index 1bd916a9b..d522785bb 100644 --- a/bricks/test_optimizer/hooks/lib/pre_gen.dart +++ b/bricks/test_optimizer/hooks/lib/pre_gen.dart @@ -1,6 +1,3 @@ -// No need for documentation in brick hooks -// ignore_for_file: public_member_api_docs - import 'dart:io'; import 'package:hooks/dart_identifier_generator.dart'; diff --git a/bricks/test_optimizer/hooks/pubspec.yaml b/bricks/test_optimizer/hooks/pubspec.yaml index 03ef70c3b..bef5afdd8 100644 --- a/bricks/test_optimizer/hooks/pubspec.yaml +++ b/bricks/test_optimizer/hooks/pubspec.yaml @@ -13,4 +13,4 @@ dependencies: dev_dependencies: mocktail: ^1.0.0 test: ^1.25.0 - very_good_analysis: ^9.0.0 + very_good_analysis: ^10.0.0 diff --git a/e2e/pubspec.yaml b/e2e/pubspec.yaml index 1385988c1..2978ee6ac 100644 --- a/e2e/pubspec.yaml +++ b/e2e/pubspec.yaml @@ -13,6 +13,6 @@ dev_dependencies: pub_updater: ^0.5.0 test: ^1.25.0 universal_io: ^2.0.4 - very_good_analysis: ^9.0.0 + very_good_analysis: ^10.0.0 very_good_cli: path: ../ diff --git a/e2e/test/commands/create/dart_cli/dart_cli_test.dart b/e2e/test/commands/create/dart_cli/dart_cli_test.dart index 6de6ab40c..c43f4991a 100644 --- a/e2e/test/commands/create/dart_cli/dart_cli_test.dart +++ b/e2e/test/commands/create/dart_cli/dart_cli_test.dart @@ -64,7 +64,7 @@ void main() { ['coverage/lcov.info', '-o', 'coverage'], workingDirectory: workingDirectory, ); - expect(testCoverageResult.stdout, contains('lines......: 100.0%')); + expect(testCoverageResult.stdout, matches(RegExp('lines(.+) 100.0%'))); }), ); } diff --git a/e2e/test/commands/create/dart_package/dart_pkg_test.dart b/e2e/test/commands/create/dart_package/dart_pkg_test.dart index 96d0c16f8..79c5f614e 100644 --- a/e2e/test/commands/create/dart_package/dart_pkg_test.dart +++ b/e2e/test/commands/create/dart_package/dart_pkg_test.dart @@ -65,7 +65,7 @@ void main() { ['coverage/lcov.info', '-o', 'coverage'], workingDirectory: workingDirectory, ); - expect(testCoverageResult.stdout, contains('lines......: 100.0%')); + expect(testCoverageResult.stdout, matches(RegExp('lines(.+) 100.0%'))); }), ); } diff --git a/e2e/test/commands/create/flutter_package/flutter_pkg_test.dart b/e2e/test/commands/create/flutter_package/flutter_pkg_test.dart index 0b9c8babc..f6756426a 100644 --- a/e2e/test/commands/create/flutter_package/flutter_pkg_test.dart +++ b/e2e/test/commands/create/flutter_package/flutter_pkg_test.dart @@ -51,7 +51,7 @@ void main() { ['coverage/lcov.info', '-o', 'coverage'], workingDirectory: workingDirectory, ); - expect(testCoverageResult.stdout, contains('lines......: 100.0%')); + expect(testCoverageResult.stdout, matches(RegExp('lines(.+) 100.0%'))); }), ); } diff --git a/e2e/test/commands/create/flutter_plugin/flutter_plugin_test.dart b/e2e/test/commands/create/flutter_plugin/flutter_plugin_test.dart index 66f0b417b..026f9a7a3 100644 --- a/e2e/test/commands/create/flutter_plugin/flutter_plugin_test.dart +++ b/e2e/test/commands/create/flutter_plugin/flutter_plugin_test.dart @@ -65,7 +65,7 @@ void main() { ['coverage/lcov.info', '-o', 'coverage'], workingDirectory: packageDirectory, ); - expect(testCoverageResult.stdout, contains('lines......: 100.0%')); + expect(testCoverageResult.stdout, matches(RegExp('lines(.+) 100.0%'))); } }), ); diff --git a/e2e/test/commands/test/async_main/async_main_test.dart b/e2e/test/commands/test/async_main/async_main_test.dart index d26b6f5e8..b29c30bf2 100644 --- a/e2e/test/commands/test/async_main/async_main_test.dart +++ b/e2e/test/commands/test/async_main/async_main_test.dart @@ -22,16 +22,15 @@ void main() { await copyDirectory(fixture, tempDirectory); - await expectSuccessfulProcessResult('flutter', [ - 'pub', - 'get', - ], workingDirectory: tempDirectory.path); + await expectSuccessfulProcessResult( + 'flutter', + ['pub', 'get'], + workingDirectory: tempDirectory.path, + ); final cwd = Directory.current; Directory.current = tempDirectory; - addTearDown(() { - Directory.current = cwd; - }); + addTearDown(() => Directory.current = cwd); final result = await commandRunner.run(['test']); expect(result, equals(ExitCode.success.code)); diff --git a/e2e/test/commands/test/compilation_error/compilation_error_test.dart b/e2e/test/commands/test/compilation_error/compilation_error_test.dart index 1190104bf..0c5b53b13 100644 --- a/e2e/test/commands/test/compilation_error/compilation_error_test.dart +++ b/e2e/test/commands/test/compilation_error/compilation_error_test.dart @@ -20,22 +20,23 @@ void main() { tempDirectory, ); - await expectSuccessfulProcessResult('flutter', [ - 'pub', - 'get', - ], workingDirectory: tempDirectory.path); + await expectSuccessfulProcessResult( + 'flutter', + ['pub', 'get'], + workingDirectory: tempDirectory.path, + ); final cwd = Directory.current; Directory.current = tempDirectory; - addTearDown(() { - Directory.current = cwd; - }); + addTearDown(() => Directory.current = cwd); final result = await commandRunner.run(['test']); expect(result, equals(ExitCode.unavailable.code)); verify( - () => logger.err(any(that: contains('- test/.test_optimizer.dart'))), + () => logger.err( + any(that: contains('- test/.test_optimizer.dart')), + ), ).called(1); }), ); diff --git a/e2e/test/commands/test/compilation_error/fixture/test/src/my_package_test.dart b/e2e/test/commands/test/compilation_error/fixture/test/src/my_package_test.dart index f7c11e40d..5553fb0b8 100644 --- a/e2e/test/commands/test/compilation_error/fixture/test/src/my_package_test.dart +++ b/e2e/test/commands/test/compilation_error/fixture/test/src/my_package_test.dart @@ -4,7 +4,9 @@ import 'package:compilation_error/compilation_error.dart'; import 'package:test/test.dart'; void main() { - test('can be instantiated', () { - expect(Thing(thing: true), isNull); + group(Thing, () { + test('can be instantiated', () { + expect(Thing(thing: true), isNull); + }); }); } diff --git a/e2e/test/commands/test/spaced_golden_file_name/spaced_golden_file_name_test.dart b/e2e/test/commands/test/spaced_golden_file_name/spaced_golden_file_name_test.dart index 48de65f4b..ee907f0c2 100644 --- a/e2e/test/commands/test/spaced_golden_file_name/spaced_golden_file_name_test.dart +++ b/e2e/test/commands/test/spaced_golden_file_name/spaced_golden_file_name_test.dart @@ -18,14 +18,17 @@ void main() { tempDirectory, ); - await expectSuccessfulProcessResult('flutter', [ - 'pub', - 'get', - ], workingDirectory: tempDirectory.path); - await expectSuccessfulProcessResult('flutter', [ - 'test', - '--update-goldens', - ], workingDirectory: tempDirectory.path); + await expectSuccessfulProcessResult( + 'flutter', + ['pub', 'get'], + workingDirectory: tempDirectory.path, + ); + + await expectSuccessfulProcessResult( + 'flutter', + ['test', '--update-goldens'], + workingDirectory: tempDirectory.path, + ); Directory.current = tempDirectory; final result = await commandRunner.run(['test']); diff --git a/lib/src/cli/templates/test_optimizer_bundle.dart b/lib/src/cli/templates/test_optimizer_bundle.dart index f521b93ca..9d844641d 100644 --- a/lib/src/cli/templates/test_optimizer_bundle.dart +++ b/lib/src/cli/templates/test_optimizer_bundle.dart @@ -23,7 +23,7 @@ final testOptimizerBundle = MasonBundle.fromJson({ { "path": "lib/pre_gen.dart", "data": - "Ly8gTm8gbmVlZCBmb3IgZG9jdW1lbnRhdGlvbiBpbiBicmljayBob29rcwovLyBpZ25vcmVfZm9yX2ZpbGU6IHB1YmxpY19tZW1iZXJfYXBpX2RvY3MKCmltcG9ydCAnZGFydDppbyc7CgppbXBvcnQgJ3BhY2thZ2U6aG9va3MvZGFydF9pZGVudGlmaWVyX2dlbmVyYXRvci5kYXJ0JzsKaW1wb3J0ICdwYWNrYWdlOm1hc29uL21hc29uLmRhcnQnOwppbXBvcnQgJ3BhY2thZ2U6cGF0aC9wYXRoLmRhcnQnIGFzIHBhdGg7Cgp0eXBlZGVmIEV4aXRGbiA9IE5ldmVyIEZ1bmN0aW9uKGludCBjb2RlKTsKCkV4aXRGbiBleGl0Rm4gPSBleGl0OwoKRnV0dXJlPHZvaWQ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xhdGl2ZShlbnRpdHkucGF0aCwgZnJvbTogdGVzdERpci5wYXRoKQogICAgICAgIC5yZXBsYWNlQWxsKHInXCcsICcvJyk7CiAgICB0ZXN0SWRlbnRpZmllclRhYmxlLmFkZCh7CiAgICAgICdwYXRoJzogcmVsYXRpdmVQYXRoLAogICAgICAnaWRlbnRpZmllcic6IGlkZW50aWZpZXJHZW5lcmF0b3IubmV4dCgpLAogICAgfSk7CiAgfQoKICBjb250ZXh0LnZhcnMgPSB7J3Rlc3RzJzogdGVzdElkZW50aWZpZXJUYWJsZSwgJ2lzRmx1dHRlcic6IGlzRmx1dHRlcn07Cn0KCmV4dGVuc2lvbiBvbiBGaWxlU3lzdGVtRW50aXR5IHsKICBib29sIGdldCBpc1Rlc3QgewogICAgcmV0dXJuIHRoaXMgaXMgRmlsZSAmJiBwYXRoLmJhc2VuYW1lKHRoaXMucGF0aCkuZW5kc1dpdGgoJ190ZXN0LmRhcnQnKTsKICB9Cn0K", "type": "text", }, { @@ -35,7 +35,7 @@ final testOptimizerBundle = MasonBundle.fromJson({ { "path": "pubspec.yaml", "data": - "bmFtZTogaG9va3MKcHVibGlzaF90bzogbm9uZQoKZW52aXJvbm1lbnQ6CiAgc2RrOiBeMy45LjAKCmRlcGVuZGVuY2llczoKICBtYXNvbjogXjAuMS4wCiAgcGF0aDogXjEuOC4xCgojIEJld2FyZTogb24gaG9va3MsIGV2ZW4gZGV2IGRlcGVuZGVuY2llcyBoYXZlIHRvIGJlIGNvbXBhdGlibGUgdG8gYWxsIGRhcnQgdmVyc2lvbnMgY292ZXJlZCBieQojIHRoZSBzZGsgY29uc3RyYWludHMgYWJvdmUKZGV2X2RlcGVuZGVuY2llczoKICBtb2NrdGFpbDogXjEuMC4wCiAgdGVzdDogXjEuMjUuMAogIHZlcnlfZ29vZF9hbmFseXNpczogXjkuMC4wCg==", + "bmFtZTogaG9va3MKcHVibGlzaF90bzogbm9uZQoKZW52aXJvbm1lbnQ6CiAgc2RrOiBeMy45LjAKCmRlcGVuZGVuY2llczoKICBtYXNvbjogXjAuMS4wCiAgcGF0aDogXjEuOC4xCgojIEJld2FyZTogb24gaG9va3MsIGV2ZW4gZGV2IGRlcGVuZGVuY2llcyBoYXZlIHRvIGJlIGNvbXBhdGlibGUgdG8gYWxsIGRhcnQgdmVyc2lvbnMgY292ZXJlZCBieQojIHRoZSBzZGsgY29uc3RyYWludHMgYWJvdmUKZGV2X2RlcGVuZGVuY2llczoKICBtb2NrdGFpbDogXjEuMC4wCiAgdGVzdDogXjEuMjUuMAogIHZlcnlfZ29vZF9hbmFseXNpczogXjEwLjAuMAo=", "type": "text", }, { diff --git a/lib/src/cli/test_cli_runner.dart b/lib/src/cli/test_cli_runner.dart index c674c09fd..8dd782cb6 100644 --- a/lib/src/cli/test_cli_runner.dart +++ b/lib/src/cli/test_cli_runner.dart @@ -325,8 +325,8 @@ Future _testCommand({ ], runInShell: true, ).listen( - (event) { - if (event.shouldCancelTimer()) timerSubscription.cancel(); + (event) async { + if (event.shouldCancelTimer()) unawaited(timerSubscription.cancel()); if (event is SuiteTestEvent) suites[event.suite.id] = event.suite; if (event is GroupTestEvent) groups[event.group.id] = event.group; if (event is TestStartEvent) tests[event.test.id] = event.test; @@ -451,8 +451,8 @@ Future _testCommand({ if (event is ExitTestEvent) { if (completer.isCompleted) return; - subscription.cancel(); - sigintWatchSubscription.cancel(); + unawaited(subscription.cancel()); + unawaited(sigintWatchSubscription.cancel()); completer.complete( event.exitCode == ExitCode.success.code diff --git a/lib/src/commands/create/commands/flame_game.dart b/lib/src/commands/create/commands/flame_game.dart index 1808a9d3c..14e462ac5 100644 --- a/lib/src/commands/create/commands/flame_game.dart +++ b/lib/src/commands/create/commands/flame_game.dart @@ -40,11 +40,8 @@ class CreateFlameGame extends CreateSubCommand with OrgName { @override Map getTemplateVars() { final vars = super.getTemplateVars(); - final platforms = argResults['platforms'] as List; - vars['platforms'] = platforms; - return vars; } } diff --git a/pubspec.yaml b/pubspec.yaml index 470f64e67..803d7f75a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -36,7 +36,7 @@ dev_dependencies: build_verify: ^3.1.0 mocktail: ^1.0.4 test: ^1.25.8 - very_good_analysis: ^9.0.0 + very_good_analysis: ^10.0.0 executables: very_good: diff --git a/test/src/cli/dart_cli_test.dart b/test/src/cli/dart_cli_test.dart index 675795ad1..a888b93df 100644 --- a/test/src/cli/dart_cli_test.dart +++ b/test/src/cli/dart_cli_test.dart @@ -73,14 +73,14 @@ void main() { }); group('.installed', () { - test('returns true when dart is installed', () { - ProcessOverrides.runZoned( + test('returns true when dart is installed', () async { + await ProcessOverrides.runZoned( () => expectLater(Dart.installed(logger: logger), completion(isTrue)), runProcess: process.run, ); }); - test('returns false when dart is not installed', () { + test('returns false when dart is not installed', () async { final processResult = ProcessResult( 42, ExitCode.software.code, @@ -97,17 +97,19 @@ void main() { ), ).thenAnswer((_) async => processResult); - ProcessOverrides.runZoned( - () => - expectLater(Dart.installed(logger: logger), completion(isFalse)), + await ProcessOverrides.runZoned( + () => expectLater( + Dart.installed(logger: logger), + completion(isFalse), + ), runProcess: process.run, ); }); }); group('.pubGet', () { - test('throws when there is no pubspec.yaml', () { - ProcessOverrides.runZoned( + test('throws when there is no pubspec.yaml', () async { + await ProcessOverrides.runZoned( () => expectLater( Dart.pubGet(cwd: Directory.systemTemp.path, logger: logger), throwsA(isA()), @@ -116,7 +118,7 @@ void main() { ); }); - test('throws when process fails', () { + test('throws when process fails', () async { when( () => process.run( 'flutter', @@ -125,7 +127,8 @@ void main() { workingDirectory: any(named: 'workingDirectory'), ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + + await ProcessOverrides.runZoned( () => expectLater( Dart.pubGet(cwd: Directory.systemTemp.path, logger: logger), throwsException, @@ -134,15 +137,15 @@ void main() { ); }); - test('completes when the process succeeds', () { - ProcessOverrides.runZoned( + test('completes when the process succeeds', () async { + await ProcessOverrides.runZoned( () => expectLater(Dart.pubGet(logger: logger), completes), runProcess: process.run, ); }); - test('completes when the process succeeds (recursive)', () { - ProcessOverrides.runZoned( + test('completes when the process succeeds (recursive)', () async { + await ProcessOverrides.runZoned( () => expectLater( Dart.pubGet(recursive: true, logger: logger), completes, @@ -154,7 +157,7 @@ void main() { test( 'completes when there is a pubspec.yaml and ' 'directory is ignored (recursive)', - () { + () async { final tempDirectory = Directory.systemTemp.createTempSync(); addTearDown(() => tempDirectory.deleteSync(recursive: true)); @@ -173,7 +176,7 @@ void main() { final relativePathPrefix = '.${p.context.separator}'; - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater( Dart.pubGet( cwd: tempDirectory.path, @@ -221,7 +224,7 @@ void main() { }, ); - test('throws when process fails', () { + test('throws when process fails', () async { when( () => process.run( any(), @@ -231,13 +234,13 @@ void main() { ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater(Dart.pubGet(logger: logger), throwsException), runProcess: process.run, ); }); - test('throws when process fails (recursive)', () { + test('throws when process fails (recursive)', () async { when( () => process.run( any(), @@ -247,7 +250,7 @@ void main() { ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater( Dart.pubGet(recursive: true, logger: logger), throwsException, @@ -256,7 +259,7 @@ void main() { ); }); - test('throws when there is an unreachable git url', () { + test('throws when there is an unreachable git url', () async { final tempDirectory = Directory.systemTemp.createTempSync(); addTearDown(() => tempDirectory.deleteSync(recursive: true)); @@ -273,7 +276,7 @@ void main() { ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater( () => Dart.pubGet(cwd: tempDirectory.path, logger: logger), throwsA(isA()), @@ -284,8 +287,8 @@ void main() { }); group('.applyFixes', () { - test('completes normally', () { - ProcessOverrides.runZoned( + test('completes normally', () async { + await ProcessOverrides.runZoned( () => expectLater(Dart.applyFixes(logger: logger), completes), runProcess: process.run, ); diff --git a/test/src/cli/flutter_cli_test.dart b/test/src/cli/flutter_cli_test.dart index be9796c83..47b21e76f 100644 --- a/test/src/cli/flutter_cli_test.dart +++ b/test/src/cli/flutter_cli_test.dart @@ -1,5 +1,4 @@ // Expected usage of the plugin will need to be adjacent strings due to format. -// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars import 'dart:async'; @@ -85,7 +84,7 @@ void main() { }); group('.installed', () { - test('returns true when flutter is installed', () { + test('returns true when flutter is installed', () async { when( () => process.run( 'flutter', @@ -94,7 +93,8 @@ void main() { workingDirectory: any(named: 'workingDirectory'), ), ).thenAnswer((_) async => successProcessResult); - ProcessOverrides.runZoned( + + await ProcessOverrides.runZoned( () => expectLater( Flutter.installed(logger: logger), completion(isTrue), @@ -103,7 +103,7 @@ void main() { ); }); - test('returns false when flutter is not installed', () { + test('returns false when flutter is not installed', () async { when( () => process.run( 'flutter', @@ -112,7 +112,8 @@ void main() { workingDirectory: any(named: 'workingDirectory'), ), ).thenThrow(Exception('flutter not installed')); - ProcessOverrides.runZoned( + + await ProcessOverrides.runZoned( () => expectLater( Flutter.installed(logger: logger), completion(isFalse), @@ -123,8 +124,8 @@ void main() { }); group('.pubGet', () { - test('throws when there is no pubspec.yaml', () { - ProcessOverrides.runZoned( + test('throws when there is no pubspec.yaml', () async { + await ProcessOverrides.runZoned( () => expectLater( Flutter.pubGet(cwd: Directory.systemTemp.path, logger: logger), throwsA(isA()), @@ -133,7 +134,7 @@ void main() { ); }); - test('throws when process fails', () { + test('throws when process fails', () async { when( () => process.run( 'flutter', @@ -142,7 +143,8 @@ void main() { workingDirectory: any(named: 'workingDirectory'), ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + + await ProcessOverrides.runZoned( () => expectLater( Flutter.pubGet(cwd: Directory.systemTemp.path, logger: logger), throwsException, @@ -151,15 +153,15 @@ void main() { ); }); - test('completes when the process succeeds', () { - ProcessOverrides.runZoned( + test('completes when the process succeeds', () async { + await ProcessOverrides.runZoned( () => expectLater(Flutter.pubGet(logger: logger), completes), runProcess: process.run, ); }); - test('completes when the process succeeds (recursive)', () { - ProcessOverrides.runZoned( + test('completes when the process succeeds (recursive)', () async { + await ProcessOverrides.runZoned( () => expectLater( Flutter.pubGet(recursive: true, logger: logger), completes, @@ -171,7 +173,7 @@ void main() { test( 'completes when there is a pubspec.yaml and ' 'directory is ignored (recursive)', - () { + () async { final tempDirectory = Directory.systemTemp.createTempSync(); addTearDown(() => tempDirectory.deleteSync(recursive: true)); @@ -190,7 +192,7 @@ void main() { final relativePathPrefix = '.${p.context.separator}'; - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater( Dart.pubGet( cwd: tempDirectory.path, @@ -238,7 +240,7 @@ void main() { }, ); - test('throws when process fails', () { + test('throws when process fails', () async { when( () => process.run( any(), @@ -248,13 +250,13 @@ void main() { ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater(Flutter.pubGet(logger: logger), throwsException), runProcess: process.run, ); }); - test('throws when process fails (recursive)', () { + test('throws when process fails (recursive)', () async { when( () => process.run( any(), @@ -264,7 +266,7 @@ void main() { ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater( Flutter.pubGet(recursive: true, logger: logger), throwsException, @@ -273,7 +275,7 @@ void main() { ); }); - test('throws when there is an unreachable git url', () { + test('throws when there is an unreachable git url', () async { final tempDirectory = Directory.systemTemp.createTempSync(); addTearDown(() => tempDirectory.deleteSync(recursive: true)); @@ -290,7 +292,7 @@ void main() { ), ).thenAnswer((_) async => softwareErrorProcessResult); - ProcessOverrides.runZoned( + await ProcessOverrides.runZoned( () => expectLater( () => Flutter.pubGet(cwd: tempDirectory.path, logger: logger), throwsA(isA()), diff --git a/test/src/cli/test_runner_cli_test.dart b/test/src/cli/test_runner_cli_test.dart index cf2c13319..24f012324 100644 --- a/test/src/cli/test_runner_cli_test.dart +++ b/test/src/cli/test_runner_cli_test.dart @@ -1,5 +1,5 @@ // Expected usage of the plugin will need to be adjacent strings due to format. -// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars +// ignore_for_file: no_adjacent_strings_in_list import 'dart:async'; import 'dart:io'; diff --git a/test/src/command_runner_test.dart b/test/src/command_runner_test.dart index fe970b0cd..da1b0159d 100644 --- a/test/src/command_runner_test.dart +++ b/test/src/command_runner_test.dart @@ -45,9 +45,6 @@ const expectedUsage = [ 'Run "very_good help " for more information about a command.', ]; -const responseBody = - '{"name": "very_good_cli", "versions": ["0.4.0", "0.3.3"]}'; - const latestVersion = '0.0.0'; final updatePrompt = diff --git a/test/src/commands/create/commands/flame_game_test.dart b/test/src/commands/create/commands/flame_game_test.dart index b03f32c79..037f67fc2 100644 --- a/test/src/commands/create/commands/flame_game_test.dart +++ b/test/src/commands/create/commands/flame_game_test.dart @@ -1,4 +1,4 @@ -// Expected usage of the game will need to be adjacent strings due to format +// Expected usage of the game will need to be adjacent strings due to format. // ignore_for_file: lines_longer_than_80_chars, no_adjacent_strings_in_list import 'dart:io'; @@ -66,7 +66,6 @@ void main() { setUp(() { progressLogs = []; - logger = _MockLogger(); final progress = _MockProgress(); diff --git a/test/src/commands/create/create_test.dart b/test/src/commands/create/create_test.dart index a76eda539..db1597409 100644 --- a/test/src/commands/create/create_test.dart +++ b/test/src/commands/create/create_test.dart @@ -22,12 +22,6 @@ Available subcommands: Run "very_good help" to see global options.''', ]; -const pubspec = ''' -name: example -environment: - sdk: ^3.9.0 -'''; - void main() { group('create', () { test( diff --git a/test/src/commands/dart/commands/dart_test_test.dart b/test/src/commands/dart/commands/dart_test_test.dart index 34af20a01..ef02d4b70 100644 --- a/test/src/commands/dart/commands/dart_test_test.dart +++ b/test/src/commands/dart/commands/dart_test_test.dart @@ -1,6 +1,6 @@ // Expected usage of the plugin will need to be adjacent strings due to format // and also be longer than 80 chars. -// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars, implicit_call_tearoffs +// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars import 'dart:io'; diff --git a/test/src/commands/dart/dart_test.dart b/test/src/commands/dart/dart_test.dart index 2e104169f..d2ecb0983 100644 --- a/test/src/commands/dart/dart_test.dart +++ b/test/src/commands/dart/dart_test.dart @@ -1,6 +1,6 @@ // Expected usage of the plugin will need to be adjacent strings due to format // and also be longer than 80 chars. -// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars +// ignore_for_file: no_adjacent_strings_in_list import 'package:mason/mason.dart'; import 'package:test/test.dart'; diff --git a/test/src/commands/packages/commands/check/check_test.dart b/test/src/commands/packages/commands/check/check_test.dart index c01778dc2..03630589c 100644 --- a/test/src/commands/packages/commands/check/check_test.dart +++ b/test/src/commands/packages/commands/check/check_test.dart @@ -1,6 +1,6 @@ // Expected usage of the plugin will need to be adjacent strings due to format // and also be longer than 80 chars. -// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars +// ignore_for_file: no_adjacent_strings_in_list import 'dart:collection'; diff --git a/test/src/commands/packages/packages_test.dart b/test/src/commands/packages/packages_test.dart index 89e24cfba..737fcf46c 100644 --- a/test/src/commands/packages/packages_test.dart +++ b/test/src/commands/packages/packages_test.dart @@ -1,6 +1,6 @@ // Expected usage of the plugin will need to be adjacent strings due to format // and also be longer than 80 chars. -// ignore_for_file: no_adjacent_strings_in_list, lines_longer_than_80_chars +// ignore_for_file: no_adjacent_strings_in_list import 'package:mason/mason.dart'; import 'package:test/test.dart'; diff --git a/tool/spdx_license/hooks/pubspec.yaml b/tool/spdx_license/hooks/pubspec.yaml index 2fcc189ac..96db55a07 100644 --- a/tool/spdx_license/hooks/pubspec.yaml +++ b/tool/spdx_license/hooks/pubspec.yaml @@ -18,4 +18,4 @@ dependencies: dev_dependencies: mocktail: ^1.0.3 test: ^1.25.2 - very_good_analysis: ^9.0.0 + very_good_analysis: ^10.0.0 diff --git a/tool/spdx_license/pubspec.yaml b/tool/spdx_license/pubspec.yaml index 176c1dd5e..b28c45d3f 100644 --- a/tool/spdx_license/pubspec.yaml +++ b/tool/spdx_license/pubspec.yaml @@ -10,4 +10,4 @@ environment: dev_dependencies: test: ^1.25.2 - very_good_analysis: ^5.1.0 + very_good_analysis: ^10.0.0