Skip to content

Commit

Permalink
Fixed #2508 - add timestamp in currentTest result (#2670)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dharin-shah committed Apr 24, 2021
1 parent fabe092 commit 708d6c4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/reporter/results.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ module.exports = class Results {
name,
module: this.moduleKey,
group: this.groupName,
results: this.getTestResult(name, {returnFullResult: true})
results: this.getTestResult(name, {returnFullResult: true}),
timestamp: this.timestamp
};
}

Expand Down
7 changes: 7 additions & 0 deletions test/src/runner/testRunWithGlobalHooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,12 @@ describe('testRunWithGlobalHooks', function() {
waitForConditionTimeout: 5,
retryAssertionTimeout: 10,
beforeEach: function(client, done) {
const testTimestamp = new Date(client.currentTest.timestamp);
const currentTimestamp = new Date();
assert.ok(testTimestamp);
assert.ok(testTimestamp.getFullYear() == currentTimestamp.getFullYear());
assert.ok(testTimestamp.getMonth() == currentTimestamp.getMonth());
assert.ok(testTimestamp.getDate() == currentTimestamp.getDate());
assert.deepEqual(client.currentTest.results, {errors: 0, failed: 0, passed: 0, assertions: [], tests: 0});
assert.strictEqual(client.currentTest.module, 'sample');
assert.strictEqual(client.currentTest.name, '');
Expand All @@ -319,6 +325,7 @@ describe('testRunWithGlobalHooks', function() {

assert.deepEqual(client.currentTest.name, 'demoTest');
assert.deepEqual(client.currentTest.module, 'sample');
assert.ok(client.currentTest.timestamp);
globals.calls++;
done();
},
Expand Down

0 comments on commit 708d6c4

Please sign in to comment.