Repository navigation
feat(fakeAsync): allow simulating the passage of time - #1837
Conversation
4d6e683 to
99ad9c0
Compare
6541eb3 to
dfec3ff
Compare
36e1be8 to
f646107
Compare
|
@matanlurey @yjbanov could one of you please review the PR ? |
|
There is an error in Dart: Any idea what could go wrong ? /cc @kevmoo |
|
They are probably missing a "library" statement at their top
|
|
@tbosch very good catch, thanks ! |
3a8f336 to
c756896
Compare
There was a problem hiding this comment.
I wonder if quiver should be a regular dependency not a dev dependency; dev dependencies are for dependencies that are only needed when developing this package. The key difference in how they are handled is how they propagate to users of this package; dev dependencies won't be installed if someone is just using angular, which means that if someone adds angular as a dep without also adding quiver as a dep, then the fake_async library will be broken.
There was a problem hiding this comment.
Good point, I was unsure when I added it.
There are actually 2 pubspec modified by this release:
modules/angular2/pubspec.yaml,/pubspec.yaml
Is 1 used by the generated angular2 pub pkg and need to have quiver as a dependency ?
Is 2 used internally by angluar2 test and can have quiver as a dev*dependency ?
/cc @yjbanov
There was a problem hiding this comment.
For 2, is something there actually directly using quiver (it doesn't look like it to me, but I don't fully understand what is going on here)? If not then, it should just be removed from 2.
|
Regarding the last checkbox, you can't use Zones to "monkey patch" arbitrary statics like |
|
@seaneagan thanks for the info. I'll probably handle this as a separate PR. I'll make sure to your comment into account. |
|
rebased and updated the internal |
There was a problem hiding this comment.
use 80-character line length in Dart files
|
Some code style nits. LGTM otherwise. |
|
@yjbanov could you please udpdate https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-coding-rules with wathever convetion we should use for Dart (ie Dart style guide plus emphasis the 80 ch limit as we use 100 for JS) |
9dcf9bb to
4bb6d7a
Compare
|
@yjbanov any update on the release of quiver ? |
|
@cbracken what's the status of quiver |
|
@cbracken what's the status of quiver 0.21.4 release? |
|
@vicb We're good to release any time. Is there anything left to be merged on this PR before we release? |
|
nothing more on my side, thanks |
|
Published! |
|
Thanks @cbracken |
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
relates to #1146
Implementation details:
fakeAsync(testFn)tick(millis)andflushMicrotasks()are top level functions in the fake_async module. Passing afakeAsyncinstance to test function would not play well withinject().JS specific
Based on Jasmine async mocks.
There is one bug in <2.3.3 that prevents a periodic timer from being cancelled from within its callback. It explains why 1 test is skipped with jasmine. I have opened a separate issue for this.
Warning:
fakeAsync()is not usable in the CJS environment whereglobal.zoneis not availableDart specific
Based on quiver.
It is not (yet) possible to get the number of pending timers at the end of the
fakeAsync().I have submitted an issue to quiver (link below).
@matanlurey @jbdeboer @yjbanov could you help with that ?
Due to the item 2 above,
fakeAsync()is not re-entrant in Dart. I don't think this is a problem ?/cc @mhevery @yjbanov @tbosch
TODO
it('...', fakeAsync(...));NgZonewhen available,Date? could be a separate PR - ref feat(fakeAsync): allow simulating the passage of time #1837 (comment)