From 2a20b6fc86b702bb7440b0077d8a01aa2b1d1689 Mon Sep 17 00:00:00 2001 From: palashgdev Date: Tue, 7 Feb 2023 16:42:49 +0530 Subject: [PATCH] fix: unit test is fixed with react 18 (#2199) --- frontend/jest.config.ts | 1 + frontend/package.json | 9 ++++----- frontend/src/components/NotFound/NotFound.test.tsx | 4 ---- .../TraceFlameGraph/__tests__/TraceFlameGraph.test.tsx | 7 +------ 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/frontend/jest.config.ts b/frontend/jest.config.ts index f85772a0e8..9021421c78 100644 --- a/frontend/jest.config.ts +++ b/frontend/jest.config.ts @@ -25,6 +25,7 @@ const config: Config.InitialOptions = { setupFilesAfterEnv: ['jest.setup.ts'], testPathIgnorePatterns: ['/node_modules/', '/public/'], moduleDirectories: ['node_modules', 'src'], + testEnvironment: 'jest-environment-jsdom', testEnvironmentOptions: { 'jest-playwright': { browsers: ['chromium', 'firefox', 'webkit'], diff --git a/frontend/package.json b/frontend/package.json index 3aefa4f697..b0aec96f2b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -31,10 +31,6 @@ "@ant-design/icons": "4.8.0", "@grafana/data": "^8.4.3", "@monaco-editor/react": "^4.3.1", - "@testing-library/jest-dom": "^5.11.4", - "@testing-library/react": "^11.1.0", - "@testing-library/user-event": "^12.1.10", - "@welldone-software/why-did-you-render": "^6.2.1", "@xstate/react": "^3.0.0", "antd": "5.0.5", "axios": "^0.21.0", @@ -121,7 +117,9 @@ "@commitlint/config-conventional": "^16.2.4", "@jest/globals": "^27.5.1", "@playwright/test": "^1.22.0", - "@testing-library/react-hooks": "^7.0.2", + "@testing-library/jest-dom": "5.16.5", + "@testing-library/react": "13.4.0", + "@testing-library/user-event": "14.4.3", "@types/color": "^3.0.3", "@types/compression-webpack-plugin": "^9.0.0", "@types/copy-webpack-plugin": "^8.0.1", @@ -147,6 +145,7 @@ "@types/webpack-dev-server": "^4.3.0", "@typescript-eslint/eslint-plugin": "^4.28.2", "@typescript-eslint/parser": "^4.28.2", + "@welldone-software/why-did-you-render": "6.2.1", "autoprefixer": "^9.0.0", "babel-plugin-styled-components": "^1.12.0", "compression-webpack-plugin": "9.0.0", diff --git a/frontend/src/components/NotFound/NotFound.test.tsx b/frontend/src/components/NotFound/NotFound.test.tsx index d6daf988f8..0eed86262c 100644 --- a/frontend/src/components/NotFound/NotFound.test.tsx +++ b/frontend/src/components/NotFound/NotFound.test.tsx @@ -1,7 +1,3 @@ -/** - * @jest-environment jsdom - */ - import { render } from '@testing-library/react'; import React from 'react'; import { Provider } from 'react-redux'; diff --git a/frontend/src/container/TraceFlameGraph/__tests__/TraceFlameGraph.test.tsx b/frontend/src/container/TraceFlameGraph/__tests__/TraceFlameGraph.test.tsx index fef6314c5a..08464ab8b0 100644 --- a/frontend/src/container/TraceFlameGraph/__tests__/TraceFlameGraph.test.tsx +++ b/frontend/src/container/TraceFlameGraph/__tests__/TraceFlameGraph.test.tsx @@ -1,9 +1,4 @@ -/** - * @jest-environment jsdom - */ - -import { render } from '@testing-library/react'; -import { renderHook } from '@testing-library/react-hooks'; +import { render, renderHook } from '@testing-library/react'; import TraceFlameGraph from 'container/TraceFlameGraph'; import React, { useState } from 'react'; import { Provider } from 'react-redux';