Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign updon't spawn child zones from the root zone automatically for callabacks + don't leak zones in async jasmine tests #94
Conversation
For now I'm not documenting this api. I think it generally useful and harmless enough that it could be a public api.
|
@mhevery can you please review this as well. especially these changes:
The latter one should be something that anyone that writes jasmine tests for code using zones should be using. That means angular/angular repo and any angular app. This makes me quite sad. |
cc4ba63
to
dc9e04b
|
for some reason saucelabs fails to provide us with FF37 at the moment. hopefully this is just a temp issue. feel free to rerun the build when you are reviewing this. it should pass all tests. |
|
@btford I'm not sure if |
|
Isn't the 2nd commit (do not fork the root zone) a BC break ?
|
|
Great PR btw ! |
This comment has been minimized.
This comment has been minimized.
|
I'm not sure if this commit is right by itself ? console.log(zone.isRootZone()); // true
setTimeout(function() {
console.log(zone.isRootZone()); // false while I would expect true
}IMO it would make more sense to squash this one with "fix: don't fork new zones for callbacks from the root zone" |
This comment has been minimized.
This comment has been minimized.
|
this is because of a bug that I fixed in the later commit. currently we create new zones for all callbacks. even if no custom zone was installed. |
This comment has been minimized.
This comment has been minimized.
I'm only saying that without your later fix, this commit is buggy. That's why I think your should squash the commits (or change their order) |
This comment has been minimized.
This comment has been minimized.
|
And may be add a test from my first comment above. |
This comment has been minimized.
This comment has been minimized.
|
there are tests that test this behavior already. besides the setTimeout test will fail after the extraneous zone spawning is fixed. so I think it's good as is. I also can't change the order because the next commit depends on this one. and the last option to squash the two commits doesn't feel right since one adds a feature and the other fixes a bug with a breaking change. I suggest keeping as is. |
|
RE: #94 (comment) +1, we should try to cut a v0.4.x release, then get all this in, then release v0.5. |
| // global beforeEach to check if we always start from the root zone | ||
| beforeEach(function() { | ||
| expect(window.zone.isRootZone()).toBe(true); | ||
| }); |
btford
May 4, 2015
Contributor
Missing EOL
Missing EOL
IgorMinar
May 7, 2015
Author
Member
there is an eol
there is an eol
|
|
||
| (function() { | ||
| // patch jasmine's it and fit functions so that the `done` callback always resets the zone | ||
| // to the jasmine zone, which should be the root zone. |
btford
May 4, 2015
Contributor
Link to GH issue/discussion
Link to GH issue/discussion
|
LGTM other than the few cosmetic things. |
|
looks reasonable to me. |
|
@btford @IgorMinar What about you (I can not) make a release out of master as of now and I integrate all those changes in the split PR (#82) and merge it so that I we can get 0.5 out (would be great if this can happen tomorrow) ? @IgorMinar If you have no news about what's going on with FF, let's stick to the currently used version for now ? Have you asked sauce labs support ? |
|
I haven't had time to work on this. We should definitely upgrade FF since it's unlikely that anyone we care about is using the version we are testing against. Can you try to fiddle with it, maybe use slightly older version of FF? I think the rest of the commits are good to go. I can merge those in tomorrow morning. |
I could
Not sure if it is valuable to merge them on top of master. What I would love to see is a release on the current master and then I'll merge my CJS PR and integrate your commits into there and then we cut a 0.5. I've tried to reach you on hangout w/o success to discuss about this |
|
@IgorMinar context: the CJS PR is required for angular2 VmTurnZone which I would love to be able to merge shortly. |
BREAKING CHANGE: New child zones are now created only from a async task that installed a custom zone. Previously even without a custom zone installed (e.g. LongStacktracesZone), we would spawn new child zones for all asynchronous events. This is undesirable and generally not useful. It does not make sense for us to create new zones for callbacks from the root zone since we care only about callbacks from installed custom zones. This reduces the overhead of zones. This primarily means that LongStackTraces zone won't be able to trace events back to Zone.init(), but instead the starting point will be the installation of the LongStacktracesZone. In all practical situations this should be sufficient. Closes #92
… zone
Now that we don't leak zone in between tests and root zone doesn't spawn child zones automatically for all callbacks we need to wrap all async tests into a test zone.
93e995a
to
9a1a7b9
|
merged into #82 last commit excluded, should I cheery pick this one also ? |
|
@vicb you do want the sauce connect update, please cp that as well |
in order to get ff37 from saucelabs we need selenium 2.45.0 that's why I'm upgrading both
|
OMG. GREEN BUILD. THAT CAN'T BE TRUE! @vicb please cp also the ff upgrade and you should be golden |
|
GREAT !!!! FF37 launches ok right now... but I'm still seeing the "expect" issue now :( |
| @@ -8,7 +8,7 @@ var zone = null; | |||
| function Zone(parentZone, data) { | |||
| var zone = (arguments.length) ? Object.create(parentZone) : this; | |||
|
|
|||
| zone.parent = parentZone; | |||
| zone.parent = parentZone || null; | |||
vicb
May 8, 2015
Contributor
Doesn't this invalidate a lot of tests ?
ie expect(window.zone.parent).toBeDefined(); to test if the zone is the root zone ?
I'll try to update to isRootZone
Doesn't this invalidate a lot of tests ?
ie expect(window.zone.parent).toBeDefined(); to test if the zone is the root zone ?
I'll try to update to isRootZone
vicb
May 8, 2015
Contributor
Hum... it's a little more subtle: the root zone will not be forked on bind
Hum... it's a little more subtle: the root zone will not be forked on bind
IgorMinar
May 8, 2015
Author
Member
right. that's what this PR is doing and that's an intentional change :) see a few lines below.
right. that's what this PR is doing and that's an intentional change :) see a few lines below.
vicb
May 8, 2015
Contributor
right. that's what this PR is doing and that's an intentional change :) see a few lines below.
And I think this is the right thing to do. The wrong part is not to have updated the tests ;)
right. that's what this PR is doing and that's an intentional change :) see a few lines below.
And I think this is the right thing to do. The wrong part is not to have updated the tests ;)
|
Playing with
That triggers the error, even locally:
As always the error was in the last file in the folder... took me 15+ iterations to found it :( |
|
And the reason is: |
|
OMG... DEEEP GREEEN !!! |
|
|
fixed in my PR |
|
merged via #82 |
No description provided.