-
Notifications
You must be signed in to change notification settings - Fork 214
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
Merge package:mockito
#2293
Merge package:mockito
#2293
Conversation
* Allow two mocks of the same class (with different type arguments) to be specified with different fallback generators. * Allow fallback generators on super types of a mocked class. This change strongly suggested a code restructuring, moving the bulk of the code-building into a new "MockClassInfo" class, extracted from MockLibraryInfo. I've incorporated this change; most of the fields on MockLibraryInfo is moved to MockClassInfo; only a few fields remain, which are fields important to be shared across class-building code. PiperOrigin-RevId: 378307281
https://dart-review.googlesource.com/c/sdk/+/205140 PiperOrigin-RevId: 382130899
dart-lang/mockito@cc1b0c8 Fix spelling and grammar typos in README.md PiperOrigin-RevId: 382620480
dart-lang/mockito@825e213 Follow Dart file conventions | Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case. PiperOrigin-RevId: 382634050
PiperOrigin-RevId: 382755039
Generated code may import 'src' files. PiperOrigin-RevId: 382756565
The inference_failure_on_instance_creation error will trigger on code like ``` returnValueForMissingStub: Future.value() ``` because, even though no value has been given to `value()`, that does not affect the Future's type (it still defaults to `void`). Explicitly using `Future<void>.value()` satisfies the check. PiperOrigin-RevId: 382770034
Without this support, mockito tried to create a FakeFunction which implemented Function, which is not allowed. Fixes dart-lang/mockito#442 PiperOrigin-RevId: 384852004
…e<T>`. Before this fix, we would only return `[]` which had an implicit dynamic: `<dynamic>[]`. The proper return value should explicitly include the expected type argument. Existing test cases cover the desired behavior. Also replace `var` with `final` in surrounding code. Fixes dart-lang/mockito#445 PiperOrigin-RevId: 384965296
PiperOrigin-RevId: 385356711
If the generated code needs to represent a type, `T`, and that type is declared in library `L`, then we now prefer to import a library which _exports_ `L` (if one exists), over importing `L` directly. To find such a library, we look at the type, `U` which references `T`. Perhaps `U` is a class to mocked, and `U` has a method with a return type `T`, or `U` is a supertype of a class to be mocked, which has a method with a parameter type `T`, etc. We examine all of the import libraries, `IL`, of the library in which `U` is declared, and all of the libraries which are exported by the libraries `IL`. If the type `T` is declared in a library which is exported as a conditional export, this strategy avoids complications with the conditional export. Additionally, as a heuristic, it generally leads to public libraries which export private implementation, avoiding importing the private implementation directly. Fixes dart-lang/mockito#443 PiperOrigin-RevId: 385425794
PiperOrigin-RevId: 385440655
We might generate setters without getters. PiperOrigin-RevId: 385802287
* Properly reference types in overridden `toString` implementations. Fixes dart-lang/mockito#438 * Override `toString` in a Fake implementation when the class-to-be-faked has a superclass which overrides `toString` with additional parameters. Fixes dart-lang/mockito#371 PiperOrigin-RevId: 385852381
…rarchy. Previously, mixins were being applied in the wrong order. By using analyzer's InheritanceManager3, instead of my homespun inheritance-walking algorithm, we solve this problem, and perhaps other unreported issues. Fixes dart-lang/mockito#456 PiperOrigin-RevId: 387741287
Without this fix, the generator could generate multiple classes with the same name. Fixes dart-lang/mockito#441 PiperOrigin-RevId: 388959500
* comment fix, long string fix * bump version and add to CHANGELOG PiperOrigin-RevId: 390005036
PiperOrigin-RevId: 392063226
This prepares for landing https://dart-review.googlesource.com/c/sdk/+/190360 into the analyzer. PiperOrigin-RevId: 394480352
We would like to remove them. Use `DartType.alias` instead. PiperOrigin-RevId: 395945062
typo fix PiperOrigin-RevId: 395962959
Update README.md. Tweak new text. PiperOrigin-RevId: 395963615
Fixes dart-lang/mockito#469 PiperOrigin-RevId: 395985920
Add ignore_for_file: camel_case_types to generated file PiperOrigin-RevId: 395993046
It seems like stable Dart does not yet support some features. I would advise to move this package with the failing CI, and fix the issue in a follow up. IIUC, fixing would require depending on a dev version of Dart, or removing the use of these features. |
4dd33dd
to
7c4bf82
Compare
…o formatting, so I just loosened the tests a bit manually. In auto_mocks_test, there were about 50 failures, so I cobbled together a more generic approach. I used the existing _containsAllOf() function to hook in a custom matcher that ignores differences in whitespace and trailing commas. PiperOrigin-RevId: 691644163
…t to try to not be sensitive to formatting changes before I realized that wouldn't work in auto_mocks_test and came up with something more robust. It turns out the simpler approach is still too brittle and some tests fail under the new style (specifically, the new formatter splits after `=>` when the old one doesn't). So I hoisted containsIgnoringFormatting() into a separate library and refactored custom_mocks_test to use it too. PiperOrigin-RevId: 691836139
We generally preserve positional parameter names, but in the case of wildcard parameters, we must rename them. We cannot override a wildcard parameter with a wildcard parameter, since we do use the parameter (we pass it to `super.noSuchMethod` in a call to `Invocation.method`). This change introduces some renaming logic for wildcard parameters, using new method-unique parameter names. PiperOrigin-RevId: 696158750
Bumps the github-actions group with 2 updates in the / directory: [actions/checkout](https://github.com/actions/checkout) and [dart-lang/setup-dart](https://github.com/dart-lang/setup-dart). Updates `actions/checkout` from 4.1.7 to 4.2.2 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@692973e...11bd719) Updates `dart-lang/setup-dart` from 1.6.5 to 1.7.0 - [Release notes](https://github.com/dart-lang/setup-dart/releases) - [Changelog](https://github.com/dart-lang/setup-dart/blob/main/CHANGELOG.md) - [Commits](dart-lang/setup-dart@0a8a0fc...e630b99) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions - dependency-name: dart-lang/setup-dart dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions ... Signed-off-by: dependabot[bot] <[email protected]>
…uplicate typedefs dart-lang/mockito#776 Closes: dart-lang/mockito#775 Closes: dart-lang/mockito#777 Closes: dart-lang/mockito#778 The fix for these issues is closely related so I've done both of them in a single PR. - Mockito wasn't checking for typedefs/aliases in `typeArguments` - it also wasn't looking into records on type args. - Typedefs which had the same underlying type were ignored even if the typedef had a different name These issues cause the dreaded `is missing from the asset URI mapping` error. See the related issue for a repro of each of these. I've also added regression tests for all of these. PiperOrigin-RevId: 702712435
Also bump some dep constraints: * analyzer ^6.9.0 is required as mockito uses some APIs that were introduced in that version. * That version of analyzer requires a Dart 3.6.0 SDK, so bump that constraint. * build_runner ^6.11.0 is required to avoid an issue looking for the wrong frontend_server snapshot. PiperOrigin-RevId: 702747878
7c4bf82
to
7c7cbf5
Compare
Package publishing
Documentation at https://github.com/dart-lang/ecosystem/wiki/Publishing-automation. |
I looked a bit at the issue tracker for this package and I am pretty concerned about merging it into the test repo. This package is active enough I think it should stay in its own repo. I am not able or willing to take ownership of it and don't want to be on the hook for fielding the issues, but would feel obligated to if it was in this repo. |
Hm. In my personal opinion, merging @devoncarew @srawlins any ideas? |
I don't have any feelings about where it lives. I have not been a good owner, but I won't ask anyone else to. |
mockito is pretty up in the air currently (should we own it? do we have the time to maintain and move it forward?). Let's hold off on moving this to a monorepo until we have more clarity on the medium term / long term plans. |
Allow merge commits
admin setting)git tag --list 'mockito*' | xargs git push origin
dart run pkgs/repo_manage/bin/report.dart transfer-issues --source-repo dart-lang/mockito --target-repo dart-lang/test --add-label package:mockito --apply-changes
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.