This repository has been archived by the owner on Feb 26, 2024. It is now read-only.
feat(jasmine): fix #1015, make jasmine patch compatible to jasmine 3.x #1016
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Current
zone.js
patchjasmine
to make jasmine method run inProxyZone
, so we can doasync
,fakeAsync
tospec
.But the patch not work for
jasmine 2.9.x
andjasmine 3.x
version, there are two issues,jasmine 3.x
, in the current patch, we have a globaltestProxyZone
injasmine
, thiszone
s lifecycle is,QueueRunner.prototype.execute
is invokednull
) whenQueueRunner.prototype.onComplete
is triggered.before
jamsine 3.x
, the patch work because there will only be oneonComplete
being triggered inexecute
.but in
jasmine 3.x
, inQueueRunner.prototype.execute
, there will besub QueueRunner
being initialized forjasmineReporter
, so in oneexecute
, there will be severalQueueRunner
and trigger multipleonComplete
. The sequence will look like:so we can't use
global
testProxyZone any more, we need to keep thetestProxyZone
insideQueueRunner
, and jasmine QueueRunner has aUserContext
which will be initialized whennew QueueRunner
and will be passed to all methods such asbeforeEach
,it
,describe
and so on, so in this PR, we useUserContext
to storetestProxyZone
perQueueRunner
.jasmine 2.9.x
, currently in test cases ofzone.js
we will dynamically run anit
spec whenifEnvSupports
return false, such kind of action is not allowed fromjasmine 2.9.x
becauseit
can be only executed inside adescribe
. so we just print theenv not support warning
message.