From ee6e18f04df7a888a3bed8ab10fa35f5376e958e Mon Sep 17 00:00:00 2001 From: Pierre Havelaar Date: Fri, 22 Mar 2019 10:57:53 +0000 Subject: [PATCH 1/2] added Test stats to execution context --- lib/test.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/lib/test.js b/lib/test.js index ad86c1c4f..9cca044ef 100644 --- a/lib/test.js +++ b/lib/test.js @@ -57,6 +57,19 @@ function timeout(ms) { this.timeout(ms); } +function stats() { + return { + assertCount: this.assertCount, + assertError: this.assertError, + calledEnd: this.calledEnd, + duration: this.duration, + finishing: this.finishing, + pendingAssertionCount: this.pendingAssertionCount, + planCount: this.planCount, + startedAt: this.startedAt + }; +} + const testMap = new WeakMap(); class ExecutionContext { constructor(test) { @@ -76,7 +89,8 @@ class ExecutionContext { }, { log: {value: log.bind(test)}, plan: {value: boundPlan}, - timeout: {value: timeout.bind(test)} + timeout: {value: timeout.bind(test)}, + stats: {value: stats.bind(test)} })); this.snapshot.skip = () => { @@ -101,7 +115,7 @@ class ExecutionContext { set context(context) { testMap.get(this).contextRef.set(context); } - + _throwsArgStart(assertion, file, line) { testMap.get(this).trackThrows({assertion, file, line}); } From 9d5b72292d67af05603a9c9263865d4ffeab0bb3 Mon Sep 17 00:00:00 2001 From: Pierre Havelaar Date: Fri, 22 Mar 2019 11:17:19 +0000 Subject: [PATCH 2/2] remove whitespave --- lib/test.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/test.js b/lib/test.js index 9cca044ef..e99543b74 100644 --- a/lib/test.js +++ b/lib/test.js @@ -115,7 +115,7 @@ class ExecutionContext { set context(context) { testMap.get(this).contextRef.set(context); } - + _throwsArgStart(assertion, file, line) { testMap.get(this).trackThrows({assertion, file, line}); }