angularjs - Directive got called multiple times when executing unit tests -
i'm facing strange issue , hope met same problem before, can solving it.
what have:
- a 3rd party directive
- my custom directive (view uses 3rd party directive)
- unit tests (for other components well, around 300 unit tests)
my directive uses 3rd party directive within template way:
<3rd-party-directive value="bindedvalue" style="display:none;"></3rd-party-directive> <div>{{producedvalue}}</div>
so nothing magic going there. have unit tests custom directive (6 test case).
the problem:
- if run unit tests custom directives (6 unit test), costs:
- 0.007 sec
- if run unit tests custom directives (6 unit test), costs:
- if run unit tests without custom directives unit tests (300 unit test), costs:
- 2.3 sec
- if run unit tests without custom directives unit tests (300 unit test), costs:
- if run unit tests custom directives (306 unit test), costs:
- 240 sec.
- if run unit tests custom directives (306 unit test), costs:
does meet problem before? dont want show code because it's not how implemented code. different going on here...
notes:
i run tests karma + jasmine. karma uses 100% cpu when 2nd case. when in begining of executecution fast later on it's increasingly slowing down. like:
1 - 80 unit tests --> 2 sec
81 - 120 unit tests --> 30 sec
121- 180 unit tests --> 90 sec
181- 300 unit tests --> 240 sec (here every unit test costs ~1 second...)
update
i made console.log inside custom directive , seems got called ~600 times!!! why , how? thought unit tests sandboxed-like, each 'describe' block has own sandbox.
Comments
Post a Comment