diff options
author | Revanshu Paliwal <revanshu.paliwal@sonarsource.com> | 2023-10-05 10:26:18 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-10-12 20:02:51 +0000 |
commit | d9546e30ba6cef9be308a506cdd87cc52db18694 (patch) | |
tree | 2a45d3e7641c1ff598384ca459ee8ce1e3697e23 /server/sonar-web/config | |
parent | 4444e5fdfbb3d013d1630e47dad2a3ac288204f8 (diff) | |
download | sonarqube-d9546e30ba6cef9be308a506cdd87cc52db18694.tar.gz sonarqube-d9546e30ba6cef9be308a506cdd87cc52db18694.zip |
SONAR-20409 Data dog monitoring for frontend unit test
Diffstat (limited to 'server/sonar-web/config')
-rw-r--r-- | server/sonar-web/config/jest/DataDogReporter.js (renamed from server/sonar-web/config/jest/ElasticSearchReporter.js) | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/server/sonar-web/config/jest/ElasticSearchReporter.js b/server/sonar-web/config/jest/DataDogReporter.js index 2650402e165..08ac6c8dc83 100644 --- a/server/sonar-web/config/jest/ElasticSearchReporter.js +++ b/server/sonar-web/config/jest/DataDogReporter.js @@ -21,9 +21,6 @@ const fs = require('fs'); const ES_ITEM_CATEGORY = 'Validate-UT-Frontend'; -const ES_ITEM_KIND = 'testcase'; -const ES_ITEM_OPERATION = 'total'; -const ES_ITEM_SUITE = 'Standalone'; module.exports = class ElasticSearchReporter { constructor(globalConfig, options) { @@ -60,20 +57,19 @@ module.exports = class ElasticSearchReporter { const timestamp = new Date(testClassResult.perfStats.start).toISOString(); const testClass = this.stripFilePath(testClassResult.testFilePath); - return testClassResult.testResults.map(testResult => ({ - commit, - build, - category: ES_ITEM_CATEGORY, - kind: ES_ITEM_KIND, - operation: ES_ITEM_OPERATION, - suite: ES_ITEM_SUITE, - measureClass: '', - measureMethod: '', - timestamp, - testClass, - testMethod: testResult.fullName, - duration: testResult.duration - })); + return testClassResult.testResults + .filter((test) => test.status === 'failed') + .map((testResult) => ({ + commit, + build, + category: ES_ITEM_CATEGORY, + timestamp, + testClass, + testMethod: testResult.fullName, + exceptionClass: '', + exceptionMessage: testResult.failureMessages[0], + exceptionLogs: testResult.failureMessages[0], + })); } onRunComplete(contexts, { testResults }) { |