angular/angular.js — pull request #9871 by IgorMinar (2014-11-01 15:57:15+00:00)
Title: feat(ngMock): decorator that adds Scope#$countChildScopes and Scope#$countWatchers

When writing tests it's often useful to check the number of child scopes
or watchers within the current current scope subtree. Common use-case for advanced
directives is to test that the directive is properly cleaning up after itself. These
new methods simplify writing assertions that verify that child scopes were properly
destroyed or that watchers were deregistered.

--------

## NOTE for reviewers

- This feature was asked for by Googlers, specifically @mprobst. Martin, please help with the review.
- There is a PR by @lgalfaso that could be leveraged by this feature: #5799
- I don't know if doing this as a mock decorator is the best solution because people might write unit tests that rely on this api being available in production, but it won't be. At the same time, this api should not be used by production code, so I don't want to have in under `src/`. What do others think?
- Since this feature has no impact on production code, I'm ok shipping it as part of a 1.3.x release.