Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
/// {@endtemplate}
class DartIdentifierGenerator {
/// {@macro dart_identifier_generator}
DartIdentifierGenerator([
this._chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ',
]) : _nextId = [0];
new([this._chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'])
: _nextId = [0];

final String _chars;
final List<int> _nextId;
Expand Down
2 changes: 1 addition & 1 deletion bricks/test_optimizer/hooks/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ dependencies:
dev_dependencies:
mocktail: ^1.0.0
test: ^1.25.0
very_good_analysis: ^10.3.0
very_good_analysis: ^11.0.0-rc.1
22 changes: 7 additions & 15 deletions bricks/test_optimizer/hooks/test/pre_gen_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:mocktail/mocktail.dart';
import 'package:path/path.dart' as path;
import 'package:test/test.dart';

class _MockLogger extends Mock implements Logger {}
class _MockLogger extends Mock implements Logger;

class _FakeContext extends Fake implements HookContext {
@override
Expand Down Expand Up @@ -115,12 +115,10 @@ dependencies:
File(path.join(testDir.path, 'test1_test.dart')).createSync();
File(path.join(testDir.path, 'test2_test.dart')).createSync();
File(path.join(testDir.path, 'no_test_here.dart')).createSync();
File(
path.join(testDir.path, 'not_optimized_test.dart'),
).writeAsStringSync(notOptimizedTestContent);
File(
path.join(testDir.path, 'another_not_optimized_test.dart'),
).writeAsStringSync(anotherNotOptimizedTestContent);
File(path.join(testDir.path, 'not_optimized_test.dart'))
.writeAsStringSync(notOptimizedTestContent);
File(path.join(testDir.path, 'another_not_optimized_test.dart'))
.writeAsStringSync(anotherNotOptimizedTestContent);

context.vars['package-root'] = tempDirectory.absolute.path;

Expand Down Expand Up @@ -148,14 +146,8 @@ dependencies:
);
final notOptimizedTests =
context.vars['notOptimizedTests'] as List<String>;
expect(
notOptimizedTests,
contains('not_optimized_test.dart'),
);
expect(
notOptimizedTests,
contains('another_not_optimized_test.dart'),
);
expect(notOptimizedTests, contains('not_optimized_test.dart'));
expect(notOptimizedTests, contains('another_not_optimized_test.dart'));
});
});

Expand Down
19 changes: 6 additions & 13 deletions e2e/helpers/command_helper.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import 'package:mocktail/mocktail.dart';
import 'package:pub_updater/pub_updater.dart';
import 'package:very_good_cli/src/command_runner.dart';

class _MockLogger extends Mock implements Logger {}
class _MockLogger extends Mock implements Logger;

class _MockProgress extends Mock implements Progress {}
class _MockProgress extends Mock implements Progress;

class _MockPubUpdater extends Mock implements PubUpdater {}
class _MockPubUpdater extends Mock implements PubUpdater;

void Function() _overridePrint(void Function(List<String>) fn) {
return () {
Expand Down Expand Up @@ -58,16 +58,9 @@ void Function() withRunner(
currentVersion: any(named: 'currentVersion'),
),
).thenAnswer((_) => Future.value(true));
when(
() => pubUpdater.getLatestVersion(any()),
).thenAnswer((_) => Future.value('1.0.0'));
when(() => pubUpdater.getLatestVersion(any()))
.thenAnswer((_) => Future.value('1.0.0'));

await runnerFn(
commandRunner,
logger,
pubUpdater,
printLogs,
progressLogs,
);
await runnerFn(commandRunner, logger, pubUpdater, printLogs, progressLogs);
});
}
2 changes: 1 addition & 1 deletion e2e/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ dev_dependencies:
pub_updater: ^0.5.0
test: ^1.25.0
universal_io: ^2.0.4
very_good_analysis: ^10.3.0
very_good_analysis: ^11.0.0-rc.1
very_good_cli:
path: ../
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,7 @@ void main() {
relativeProjectPath,
]);

expect(
result,
equals(ExitCode.success.code),
);
expect(result, equals(ExitCode.success.code));

expect(
progressLogs,
Expand Down
9 changes: 4 additions & 5 deletions e2e/test/commands/test/async_main/async_main_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ 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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@ 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;
Expand All @@ -34,9 +33,7 @@ void main() {

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);
}),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,15 @@ void main() {
tempDirectory,
);

await expectSuccessfulProcessResult(
'flutter',
['pub', 'get'],
workingDirectory: tempDirectory.path,
);
await expectSuccessfulProcessResult('flutter', [
'pub',
'get',
], workingDirectory: tempDirectory.path);

await expectSuccessfulProcessResult(
'flutter',
['test', '--update-goldens'],
workingDirectory: tempDirectory.path,
);
await expectSuccessfulProcessResult('flutter', [
'test',
'--update-goldens',
], workingDirectory: tempDirectory.path);

Directory.current = tempDirectory;
final result = await commandRunner.run(['test']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,7 @@ void main() {
addTearDown(() => Directory.current = cwd);

await expectLater(
commandRunner.run([
'test',
'--coverage',
'--min-coverage',
'0',
]),
commandRunner.run(['test', '--coverage', '--min-coverage', '0']),
completion(equals(ExitCode.success.code)),
);
}),
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cli/cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract class ProcessOverrides {
}

class _ProcessOverridesScope extends ProcessOverrides {
_ProcessOverridesScope(this._runProcess);
new(this._runProcess);

final ProcessOverrides? _previous = ProcessOverrides.current;
final RunProcess? _runProcess;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cli/dart_cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class Dart {
void Function(String)? stderr,
GeneratorBuilder buildGenerator = MasonGenerator.fromBundle,
List<String>? reportOn,
}) async {
}) {
return TestCLIRunner.test(
logger: logger,
testType: TestRunType.dart,
Expand Down
13 changes: 5 additions & 8 deletions lib/src/cli/flutter_cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ abstract class ProcessSignalOverrides {
}

class _ProcessSignalOverridesScope extends ProcessSignalOverrides {
_ProcessSignalOverridesScope(Stream<ProcessSignal>? mockSigintStream) {
new(Stream<ProcessSignal>? mockSigintStream) {
if (mockSigintStream != null) {
_sigintStreamController = StreamController<ProcessSignal>();
}
Expand All @@ -56,25 +56,22 @@ class _ProcessSignalOverridesScope extends ProcessSignalOverrides {
}

/// Thrown when `flutter pub get` is executed without a `pubspec.yaml`.
class PubspecNotFound implements Exception {}
class PubspecNotFound implements Exception;

/// {@template coverage_metrics}
/// Aggregated coverage metrics computed from a list of LCOV records.
/// {@endtemplate}
class CoverageMetrics {
/// {@macro coverage_metrics}
@visibleForTesting
const CoverageMetrics({
const new({
this.totalHits = 0,
this.totalFound = 0,
this.uncoveredLines = const {},
});

/// Generate coverage metrics from a list of lcov records.
factory CoverageMetrics.fromLcovRecords(
List<Record> records, {
String? excludeFromCoverage,
}) {
factory fromLcovRecords(List<Record> records, {String? excludeFromCoverage}) {
final globs = <Glob>[];

if (excludeFromCoverage != null && excludeFromCoverage.isNotEmpty) {
Expand Down Expand Up @@ -218,7 +215,7 @@ class Flutter {
void Function(String)? stderr,
GeneratorBuilder buildGenerator = MasonGenerator.fromBundle,
List<String>? reportOn,
}) async {
}) {
return TestCLIRunner.test(
logger: logger,
testType: TestRunType.flutter,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/cli/git_cli.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ part of 'cli.dart';
/// {@endtemplate}
class UnreachableGitDependency implements Exception {
/// {@macro unreachable_git_dependency}
const UnreachableGitDependency({required this.remote});
const new({required this.remote});

/// The associated git remote [Uri].
final Uri remote;
Expand Down
Loading
Loading