Skip to content

feat: use very_good_test_runner to improve test output#308

Merged
felangel merged 7 commits intomainfrom
feat/test-output-format
Mar 10, 2022
Merged

feat: use very_good_test_runner to improve test output#308
felangel merged 7 commits intomainfrom
feat/test-output-format

Conversation

@felangel
Copy link
Contributor

@felangel felangel commented Mar 9, 2022

Description

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore

@felangel felangel added the feature A new feature or request label Mar 9, 2022
@felangel felangel self-assigned this Mar 9, 2022
@felangel felangel force-pushed the feat/test-output-format branch from 1c7b6d6 to fb55ee0 Compare March 9, 2022 23:34
@scarletteliza
Copy link
Contributor

my heart is going pitter patter

@felangel felangel marked this pull request as ready for review March 10, 2022 22:26
@felangel felangel requested a review from jorgecoca as a code owner March 10, 2022 22:26
cmd: (cwd) async {
final installDone = progress?.call(
'Running "flutter test" in $cwd',
void Function(String)? stdout,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Can we create a typedef for this?


/// Run a command on directories with a `pubspec.yaml`.
Future<void> _runCommand<T>({
required Future<T> Function(String cwd) cmd,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: maybe have a type def for this?

Copy link
Contributor Author

@felangel felangel Mar 10, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you feel it's necessary? This is a private API and it's only used in this one spot. By providing a typedef developers would have to jump to the typedef to understand the function signature.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just for the sake of DRY, I've noticed this is repeated along the file.

Either way this is just a nit, I am fine either way

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where else do you see it repeated? I only see Future<T> Function(String cwd) in one spot.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, this isn't repeated, I guess I got into the flow because of the other comments

if (processes.isEmpty) throw PubspecNotFound();
Future<void> _flutterTest({
String cwd = '.',
required void Function(String) stdout,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: reuse the typedef here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here about whether you feel this is necessary? I'd prefer to leave it inline unless it's a public API (related to https://dart-lang.github.io/linter/lints/avoid_private_typedef_functions.html).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting lint rule, never thought about it that way, makes sense! Let's keep online, we can ignore all the similar comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only reason I slightly prefer to leave it as is is because let's say we create a typedef like:

typedef ArgumentCallback<T> = void Function(T argument);

Then the new signature will look like:

Future<void> _flutterTest({
  String cwd = '.',
  required ArgumentCallback<String>? stdout,
  required ArgumentCallback<String>? stderr,
}) {...}

I don't really see the benefit of the typedef in this case because as a developer, I have to look at what ArgumentCallback means above and, from a readability standpoint, I personally prefer seeing the type inline when it's simple like this especially if it's used in a private method.

Let me know what you think 👍

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, I think it makes sense, I kind find the inline function type a little bit confusing on dart, hence why I prefer to use typedef, and as a bonus we DRY.

But I agree with you, being a private method, we have have freedom to leave like this, and it is easier to spot the require method contract. Lets keep like that 👍

}
}

extension on int {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

erickzanardo
erickzanardo previously approved these changes Mar 10, 2022
Copy link
Member

@erickzanardo erickzanardo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🚀

@felangel felangel merged commit c6e4ae4 into main Mar 10, 2022
@felangel felangel deleted the feat/test-output-format branch March 10, 2022 23:37
@felangel felangel mentioned this pull request Mar 17, 2022
7 tasks
ahsanf pushed a commit to Arkabyte-Teknologi/very_good_cli that referenced this pull request Aug 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature A new feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants