Skip to content

Commit

Permalink
Merge pull request #8 from grkpranaykumar/OB_189_hotfix
Browse files Browse the repository at this point in the history
Fix git file_path and timestamp issue
  • Loading branch information
swrdfish authored May 29, 2023
2 parents 6b73a35 + e98f74b commit 229d438
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/testObservability.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class TestObservability {
identifier: `${testFileReport.name} - ${skippedTest}`,
file_name: path.relative(process.cwd(), testFileReport.modulePath),
location: path.relative(process.cwd(), testFileReport.modulePath),
vc_filepath: this._gitMetadata ? path.relative(this._gitMetadata.root, testFileReport.modulePath) : null,
vc_filepath: (this._gitMetadata && this._gitMetadata.root) ? path.relative(this._gitMetadata.root, testFileReport.modulePath) : null,
started_at: new Date(testFileReport.endTimestamp).toISOString(),
finished_at: new Date(testFileReport.endTimestamp).toISOString(),
duration_in_ms: 0,
Expand Down Expand Up @@ -315,15 +315,15 @@ class TestObservability {
identifier: `${testFileReport.name} - ${sectionName}`,
file_name: path.relative(process.cwd(), testFileReport.modulePath),
location: path.relative(process.cwd(), testFileReport.modulePath),
vc_filepath: this._gitMetadata ? path.relative(this._gitMetadata.root, testFileReport.modulePath) : null,
vc_filepath: (this._gitMetadata && this._gitMetadata.root) ? path.relative(this._gitMetadata.root, testFileReport.modulePath) : null,
started_at: new Date(eventData.startTimestamp).toISOString(),
result: 'pending',
framework: 'nightwatch',
hook_type: hookType
};

if (eventType === 'HookRunFinished' || eventType === 'TestRunFinished') {
testData.finished_at = new Date(eventData.endTimestamp).toISOString();
testData.finished_at = eventData.endTimestamp ? new Date(eventData.endTimestamp).toISOString() : new Date(eventData.startTimestamp).toISOString();
testData.result = eventData.status === 'pass' ? 'passed' : 'failed';
testData.duration_in_ms = 'timeMs' in eventData ? eventData.timeMs : eventData.time;
if (eventData.status === 'fail' && eventData.lastError) {
Expand Down

0 comments on commit 229d438

Please sign in to comment.