-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[native_assets_cli] Make package:test dev dep #1799
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, so it's an antipattern to wrap package:test
. We'd better add that to the documentation of package:test
.
Is it also an antipattern to wrap package:matcher
? It would feel natural to define matchers for our own classes.
I guess getting rid of the package:test dep is a good thing, It causes issues:
cc @mosuem
pkgs/native_assets_cli/lib/test.dart
Outdated
Future<void> testBuildHook({ | ||
required String description, | ||
/// An exception thrown when validation fails. | ||
class ValidationFailure implements Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ditto, Validate
is a term we use for something else. Also, it's an exception so maybe TestException
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated to VerificationException
.
Yes, mostly.
I'll update the PR as per the review feedback. |
Ah right. We would make a separate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated!
pkgs/native_assets_cli/lib/test.dart
Outdated
Future<void> testBuildHook({ | ||
required String description, | ||
/// An exception thrown when validation fails. | ||
class ValidationFailure implements Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated to VerificationException
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One more comment 🤓
pkgs/native_assets_cli/lib/test.dart
Outdated
} | ||
|
||
/// An exception thrown when build hook verification fails. | ||
class VerificationException implements Exception { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this class should be part of the public API. I don't believe users should catch it. So maybe it should an Error
instead? Error
itself has a message, so we could even throw Error
instead of _VerificationError
.
Or do you believe users should catch this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I looked into this a bit more. Error
itself doesn't have a message; its subclasses do. None of those look like great candidates to throw, and, it looks like expect
throws an Exception, not an Error, so I think we should do the same.
I updated this to be a ValidationFailure
, implementing an Exception and not an error. I also moved it to a place in the code where it won't be public API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm! Please add auto-submit at your convenience (after rebase).
Thanks @devoncarew! 🙏
testBuildHook
tovalidateBuildHook
andtestCodeBuildHook
to `validateCodeBuildHookWhen doing an investigation into the deps of the
dart
cli tool, I found that this was bringingpackage:test
all all its dependencies into the transitive closure of used packages. This refactors the package to still provide testing facilities but to no longer use package:test as a regular dep.Contribution guidelines:
dart format
.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.