From b63e16cfc662c0c5cdd05b9db64ac17b5644c260 Mon Sep 17 00:00:00 2001 From: Jeremy Davis Date: Wed, 21 Dec 2022 12:29:07 +0100 Subject: [PATCH] [NO JIRA] Upgrade jest-emotion --> @emotion/jest --- server/sonar-web/jest.config.js | 30 +- server/sonar-web/package.json | 1 - .../SearchShowMore-test.tsx.snap | 1 - ...nentSourceSnippetGroupViewer-test.tsx.snap | 1 - .../__snapshots__/BranchListRow-test.tsx.snap | 20 +- .../ProjectsSortingSelect-test.tsx.snap | 12 +- .../ProjectCardMeasures-test.tsx.snap | 6 - .../__snapshots__/Filter-test.tsx.snap | 14 - .../LanguagesFilter-test.tsx.snap | 1 - .../__snapshots__/TagsFilter-test.tsx.snap | 1 - .../ProfileActions-test.tsx.snap | 8 - .../HotspotCommentPopup-test.tsx.snap | 4 +- .../StatusDescription-test.tsx.snap | 4 +- .../TokensFormItem-test.tsx.snap | 8 +- .../__snapshots__/Action-test.tsx.snap | 3 - .../__snapshots__/LineCode-test.tsx.snap | 6 - .../DisableableSelectOption-test.tsx.snap | 16 +- .../SelectListItem-test.tsx.snap | 3 - .../__snapshots__/BoxedTabs-test.tsx.snap | 98 +++---- .../ModalValidationField-test.tsx.snap | 2 - .../ListStyleFacet-test.tsx.snap | 7 - .../__tests__/PageShortcutsTooltip-test.tsx | 50 +++- .../__snapshots__/Alert-test.tsx.snap | 22 +- .../PageShortcutsTooltip-test.tsx.snap | 268 ------------------ server/sonar-web/yarn.lock | 68 +---- 25 files changed, 132 insertions(+), 522 deletions(-) delete mode 100644 server/sonar-web/src/main/js/components/ui/__tests__/__snapshots__/PageShortcutsTooltip-test.tsx.snap diff --git a/server/sonar-web/jest.config.js b/server/sonar-web/jest.config.js index dfe11fab60d..38e2b543ac4 100644 --- a/server/sonar-web/jest.config.js +++ b/server/sonar-web/jest.config.js @@ -4,22 +4,22 @@ module.exports = { coverageReporters: ['lcovonly', 'text'], globals: { 'ts-jest': { - diagnostics: false - } + diagnostics: false, + }, }, moduleFileExtensions: ['ts', 'tsx', 'js', 'json'], moduleNameMapper: { '^.+\\.(md|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': '/config/jest/FileStub.js', - '^.+\\.css$': '/config/jest/CSSStub.js' + '^.+\\.css$': '/config/jest/CSSStub.js', }, setupFiles: [ '/config/polyfills.ts', '/config/jest/SetupEnzyme.ts', - '/config/jest/SetupTestEnvironment.ts' + '/config/jest/SetupTestEnvironment.ts', ], setupFilesAfterEnv: ['/config/jest/SetupReactTestingLibrary.ts'], - snapshotSerializers: ['enzyme-to-json/serializer', 'jest-emotion'], + snapshotSerializers: ['enzyme-to-json/serializer', '@emotion/jest/serializer'], testEnvironment: 'jsdom', testPathIgnorePatterns: ['/config', '/node_modules', '/scripts'], testRegex: '(/__tests__/.*|\\-test)\\.(ts|tsx|js)$', @@ -28,10 +28,10 @@ module.exports = { '@swc/jest', { jsc: { - target: 'es2018' - } - } - ] + target: 'es2018', + }, + }, + ], }, transformIgnorePatterns: ['/node_modules/(?!(d3-.+))/'], reporters: [ @@ -44,15 +44,15 @@ module.exports = { ancestorSeparator: ' > ', suiteNameTemplate: '{filename}', classNameTemplate: '{classname}', - titleTemplate: '{title}' - } + titleTemplate: '{title}', + }, ], [ './config/jest/ElasticSearchReporter.js', { - outputFilepath: '/tmp/ut-ts-web-monitoring.log' - } - ] + outputFilepath: '/tmp/ut-ts-web-monitoring.log', + }, + ], ], - testTimeout: 30000 + testTimeout: 30000, }; diff --git a/server/sonar-web/package.json b/server/sonar-web/package.json index 52c98cae9ef..abfbddd7bda 100644 --- a/server/sonar-web/package.json +++ b/server/sonar-web/package.json @@ -86,7 +86,6 @@ "fs-extra": "11.1.0", "http-proxy": "1.18.1", "jest": "29.3.1", - "jest-emotion": "10.0.32", "jest-environment-jsdom": "29.3.1", "jest-junit": "13.0.0", "jsdom": "20.0.3", diff --git a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchShowMore-test.tsx.snap b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchShowMore-test.tsx.snap index 85382613b9f..e6cdc125060 100644 --- a/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchShowMore-test.tsx.snap +++ b/server/sonar-web/src/main/js/app/components/search/__tests__/__snapshots__/SearchShowMore-test.tsx.snap @@ -10,7 +10,6 @@ exports[`should render 1`] = ` loading={false} > + @@ -53,9 +51,7 @@ exports[`should render correctly: branch with number of days 1`] = ` `; exports[`should render correctly: branch with previous version 1`] = ` - + @@ -104,9 +100,7 @@ exports[`should render correctly: branch with previous version 1`] = ` `; exports[`should render correctly: branch with reference branch 1`] = ` - + @@ -156,9 +150,7 @@ exports[`should render correctly: branch with reference branch 1`] = ` `; exports[`should render correctly: branch with specific analysis 1`] = ` - + @@ -260,9 +252,7 @@ exports[`should render correctly: faulty branch 1`] = ` `; exports[`should render correctly: main branch with default 1`] = ` - + diff --git a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap index 44825139d16..864ca534348 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/__tests__/__snapshots__/ProjectsSortingSelect-test.tsx.snap @@ -80,9 +80,7 @@ exports[`should handle the descending sort direction 1`] = ` innerRef={[Function]} onClick={[Function]} > - + @@ -175,9 +173,7 @@ exports[`should render correctly for leak view 1`] = ` innerRef={[Function]} onClick={[Function]} > - + @@ -270,9 +266,7 @@ exports[`should render correctly for overall view 1`] = ` innerRef={[Function]} onClick={[Function]} > - + diff --git a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCardMeasures-test.tsx.snap b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCardMeasures-test.tsx.snap index 20d8cf07dd1..8d9c7eb4cb3 100644 --- a/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCardMeasures-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/projects/components/project-card/__tests__/__snapshots__/ProjectCardMeasures-test.tsx.snap @@ -34,7 +34,6 @@ exports[`New code measures should be rendered properly 1`] = ` className="bordered-left little-spacer" />