---------

**Commit 1:**
fixing top_level_describe_filter to allow describe.only in unit tests

* Original sha: 14817199a7
* Authored by ppisljar <peter.pisljar@gmail.com> on 2016-09-21T08:12:41Z

**Commit 2:**
adding comment

* Original sha: 65edc94a23
* Authored by ppisljar <peter.pisljar@gmail.com> on 2016-09-21T14:05:32Z
This commit is contained in:
Elastic Jasper 2016-09-21 15:34:29 -04:00
parent 6776cda4ff
commit f3809d4893

View file

@ -67,11 +67,7 @@ export function setupTopLevelDescribeFilter(test) {
let describeCallDepth = 0;
const ignoredCalls = [];
// ensure that window.describe isn't messed with by other code
Object.defineProperty(window, 'describe', {
configurable: false,
enumerable: true,
value: function describeInterceptor(describeName, describeBody) {
const describeInterceptor = function (describeName, describeBody) {
const context = this;
const isTopLevelCall = describeCallDepth === 0;
@ -86,12 +82,23 @@ export function setupTopLevelDescribeFilter(test) {
* note that try/finally won't actually catch the error, it
* will continue to propogate up the call stack
*/
let result;
try {
describeCallDepth += 1;
originalDescribe.call(context, describeName, describeBody);
result = originalDescribe.call(context, describeName, describeBody);
} finally {
describeCallDepth -= 1;
}
}
return result;
};
// to allow describe.only calls. we dont need interceptor as it will call describe internally
describeInterceptor.only = originalDescribe.only;
// ensure that window.describe isn't messed with by other code
Object.defineProperty(window, 'describe', {
configurable: false,
enumerable: true,
value: describeInterceptor
});
}