diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/sonar-web/config/jest/DataDogReporter.js (renamed from server/sonar-web/config/jest/ElasticSearchReporter.js) | 30 | ||||
-rw-r--r-- | server/sonar-web/design-system/jest.config.js | 16 | ||||
-rw-r--r-- | server/sonar-web/jest.config.js | 4 |
3 files changed, 30 insertions, 20 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 }) { diff --git a/server/sonar-web/design-system/jest.config.js b/server/sonar-web/design-system/jest.config.js index 21af92326f2..a2399e4f397 100644 --- a/server/sonar-web/design-system/jest.config.js +++ b/server/sonar-web/design-system/jest.config.js @@ -52,11 +52,25 @@ module.exports = { setupFilesAfterEnv: ['<rootDir>/config/jest/SetupReactTestingLibrary.ts'], snapshotSerializers: ['@emotion/jest/serializer'], testEnvironment: 'jsdom', - testPathIgnorePatterns: ['<rootDir>/config/jest', '<rootDir>/node_modules', '<rootDir>/scripts', '<rootDir>/lib'], + testPathIgnorePatterns: [ + '<rootDir>/config/jest', + '<rootDir>/node_modules', + '<rootDir>/scripts', + '<rootDir>/lib', + ], testRegex: '(/__tests__/.*|\\-test)\\.(ts|tsx|js)$', transform: { '^.+\\.(t|j)sx?$': ['babel-jest', babelConfig], }, transformIgnorePatterns: ['/node_modules/(?!(d3-.+))/'], + reporters: [ + 'default', + [ + '../config/jest/DataDogReporter.js', + { + outputFilepath: '/tmp/ut-ts-designsystem-test-monitoring.log', + }, + ], + ], testTimeout: 60000, }; diff --git a/server/sonar-web/jest.config.js b/server/sonar-web/jest.config.js index 4aa418c407d..0d7280374d9 100644 --- a/server/sonar-web/jest.config.js +++ b/server/sonar-web/jest.config.js @@ -56,9 +56,9 @@ module.exports = { }, ], [ - './config/jest/ElasticSearchReporter.js', + './config/jest/DataDogReporter.js', { - outputFilepath: '/tmp/ut-ts-web-monitoring.log', + outputFilepath: '/tmp/ut-ts-web-test-monitoring.log', }, ], ['jest-slow-test-reporter', { numTests: 5, warnOnSlowerThan: 10000, color: true }], |