Skip to content

Commit 47aa776

Browse files
authored
fix: report malformed licenses as unknown (#1342)
1 parent 4a622f2 commit 47aa776

File tree

18 files changed

+198
-15
lines changed

18 files changed

+198
-15
lines changed

.github/workflows/e2e.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ jobs:
4343
# E2E tests for the `packages check licenses` command
4444
- test/commands/packages/check/licenses/licenses_allowed_test.dart
4545
- test/commands/packages/check/licenses/licenses_forbidden_test.dart
46+
- test/commands/packages/check/licenses/unknown_licenses_test.dart
4647

4748
steps:
4849
- name: 📚 Git Checkout

e2e/helpers/command_helper.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ void Function() withRunner(
3232
Logger logger,
3333
PubUpdater pubUpdater,
3434
List<String> printLogs,
35+
List<String> progressLogs,
3536
)
3637
runnerFn,
3738
) {
@@ -61,6 +62,12 @@ void Function() withRunner(
6162
() => pubUpdater.getLatestVersion(any()),
6263
).thenAnswer((_) => Future.value('1.0.0'));
6364

64-
await runnerFn(commandRunner, logger, pubUpdater, printLogs);
65+
await runnerFn(
66+
commandRunner,
67+
logger,
68+
pubUpdater,
69+
printLogs,
70+
progressLogs,
71+
);
6572
});
6673
}

e2e/test/commands/create/dart_cli/dart_cli_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create dart_cli',
1111
timeout: const Timeout(Duration(minutes: 2)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/create/dart_package/dart_pkg_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create dart_package',
1111
timeout: const Timeout(Duration(minutes: 2)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/create/docs_site/docs_site_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create docs_site',
1111
timeout: const Timeout(Duration(minutes: 2)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/create/flame_game/flame_game_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create flame_game',
1111
timeout: const Timeout(Duration(minutes: 5)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/create/flutter_app/core_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create flutter_app',
1111
timeout: const Timeout(Duration(minutes: 2)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/create/flutter_package/flutter_pkg_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create flutter_package',
1111
timeout: const Timeout(Duration(minutes: 2)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/create/flutter_plugin/flutter_plugin_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ void main() {
99
test(
1010
'create flutter_plugin',
1111
timeout: const Timeout(Duration(minutes: 8)),
12-
withRunner((commandRunner, logger, updater, logs) async {
12+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1313
final tempDirectory = Directory.systemTemp.createTempSync();
1414
addTearDown(() => tempDirectory.deleteSync(recursive: true));
1515

e2e/test/commands/packages/check/licenses/licenses_allowed_test.dart

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ void main() {
1515
test(
1616
'packages check licenses --allowed="MIT,BSD-3-Clause"',
1717
timeout: const Timeout(Duration(minutes: 2)),
18-
withRunner((commandRunner, logger, updater, logs) async {
18+
withRunner((commandRunner, logger, updater, logs, progressLogs) async {
1919
final tempDirectory = Directory.systemTemp.createTempSync();
2020
addTearDown(() => tempDirectory.deleteSync(recursive: true));
2121

@@ -52,6 +52,13 @@ void main() {
5252
equals(ExitCode.success.code),
5353
reason: 'Should succeed when allowed licenses are used',
5454
);
55+
56+
expect(
57+
progressLogs,
58+
contains(
59+
'''Retrieved 2 licenses from 2 packages of type: MIT (1) and BSD-3-Clause (1).''',
60+
),
61+
);
5562
}),
5663
);
5764
}

0 commit comments

Comments
 (0)