-
Notifications
You must be signed in to change notification settings - Fork 214
Expand "scopeLog" to make testing *way* easier #372
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
Comments
As usual, happy to make change myself, just want input from @jakemac53 / @natebosch. |
Semi-related: dart-lang/core#434. |
I'm on board with it. I think we should consider using Maybe Future<List<LogRecord>> recordLogRecords(Future action())
Future<List<String>> recordLogMessages(Future action()) |
Either of those is fine with me. I'll give @jakemac53 some time to weigh in, and if we agree I'll work on it later this week. |
Seems fine to me, +1 for LogRecord. Could also consider just returning the Logger. |
Unfortunately |
Ah sure good point. We could also consider returning a |
I'm OK with that too. But at that point might as well return |
In general if I see a In this case logs do come through incrementally so I would lean towards Stream. Also the Stream matches are nicer in some ways, specifically if you care about the ordering items you are matching against. |
I do usually think "Stream" when I see However I do think 99.9% of cases are going to want the List anyway so I'm torn on whether I want to impose that extra noise of |
Definitely my thought too. If we provide a final logs = recordLogs(() { ... });
await expectLater(logs, containsLogs([
'...',
'...',
]); |
I am curious why you think most people want a List? The primary use case I would think is with matchers. I don't know all the matchers but I think the StreamMatchers cover some use cases better. Specifically if you want to check that certain logs occur in a specific order but with arbitrary other logs in between. I am about to lose cell service tho so I won't be able to chime in again for a while, feel free to make a decision either way, both sound fine. |
Sounds a lot like In any case I don't think we need to bikeshed too much on this. Let's aim for emitting a |
Today I need the following boilerplate (from an AngularDart test):
It would be nice to reduce this, somehow, to:
The text was updated successfully, but these errors were encountered: