Comments (10)
It looks like the only invocation of true mirrors is spy
:
dynamic spy(dynamic mock, dynamic spiedObject) {
var mirror = reflect(spiedObject);
mock._defaultResponse = () => new CannedResponse(
null, (Invocation realInvocation) => mirror.delegate(realInvocation));
return mock;
}
I imagine this could be moved to mockito/spy.dart.
The rest of mirrors uses noSuchMethod
, which is a sort of mirrors-light. Is that still supported in Flutter/AOT? We've had a few conversations about code-gen based mockito that had mixed reviews.
from mockito.
It looks like noSuchMethod
works for AOT. @TedSander is this a reasonable change?
from mockito.
Yep seems reasonable. Anyone want to send a pull request? I imagine we shouldn't have a breaking change for this. So have the original entrypoint export spy.dart, and mock.dart (or something like that,) and have AOT just import the second one.
from mockito.
@Hixie does that sound OK?
We'd have:
lib/
src/
mock.dart
spy.dart
mockito.dart: Original library that also exports spy (won't work in AOT)
mockito_no_mirrors.dart: Mockito without the spy function (or whatever else is added)
from mockito.
sgtm
from mockito.
and thanks for looking at this so quickly! much appreciated.
from mockito.
@TedSander I'll shoot you a PR shortly 💋
from mockito.
@Hixie of course!
from mockito.
Alright, take a look at PR https://github.com/fibulwinter/dart-mockito/pull/28
from mockito.
Thanks!
from mockito.
Related Issues (20)
- Can't run flutter test when I add mockito, due to test_api
- Freezed models can't be mocked without json_serializable HOT 8
- 5.4.2 incompatible with Freezed 2.4.2 HOT 1
- I configured build.yaml as this repo, but it's not working as I expected HOT 1
- Mocking the (AutoDispose)FamilyNotifier with code generation incorrect HOT 1
- Provide better documentation/examples for `provideDummy`/`provideDummyBuilder` HOT 3
- `thenAnswerInOrder` support
- Bump Analyzer version to >6 HOT 2
- Generated Imports use Unescaped backslashes HOT 3
- Verify constructor HOT 1
- How to test retrofit services with mockito HOT 6
- Question: dockito in dev_dependies? HOT 1
- Error The included part 'mocks.dart' must have a part-of directive. HOT 1
- `verify` failing test but showing in "All calls" HOT 1
- mockito:mockBuilder generator fail using MockSpec custom superclass HOT 5
- How to mock Dio.interceptors.add? HOT 1
- Support for extension-type/inline-class HOT 2
- Why is build_runner is succeeding with 0 outputs? HOT 3
- Support for real executions on Mocking classes HOT 1
- Bad state: Cannot call `when` within a stub response HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mockito.