From 9b1b3b3e459cce1806d39a0dafcd23948e1693b0 Mon Sep 17 00:00:00 2001 From: Mehmet Salih Yavuz Date: Wed, 11 Mar 2026 12:21:21 +0300 Subject: [PATCH] fix: testing library version --- superset-frontend/package-lock.json | 39 +++++-------------- superset-frontend/package.json | 2 +- .../packages/superset-core/package.json | 2 +- .../packages/superset-core/src/testing.tsx | 4 +- .../superset-ui-chart-controls/package.json | 2 +- .../packages/superset-ui-core/package.json | 2 +- .../useElementOnScreen.test.ts | 16 ++++---- .../plugin-chart-ag-grid-table/package.json | 2 +- .../plugins/plugin-chart-table/package.json | 2 +- 9 files changed, 25 insertions(+), 46 deletions(-) diff --git a/superset-frontend/package-lock.json b/superset-frontend/package-lock.json index 1cee4bd244b..22b2223feec 100644 --- a/superset-frontend/package-lock.json +++ b/superset-frontend/package-lock.json @@ -190,7 +190,7 @@ "@swc/core": "^1.15.18", "@swc/plugin-emotion": "^14.6.0", "@swc/plugin-transform-imports": "^12.5.0", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^12.8.3", @@ -12420,9 +12420,9 @@ } }, "node_modules/@testing-library/dom": { - "version": "8.20.1", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.20.1.tgz", - "integrity": "sha512-/DiOQ5xBxgdYRC8LNk7U+RWat0S3qRLeIw3ZIkMQ9kkVlRmwD/Eg8k8CqIpD6GW7u20JIUOfMKbxtiLutpjQ4g==", + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.4.tgz", + "integrity": "sha512-FlS4ZWlp97iiNWig0Muq8p+3rVDjRiYE+YKGbAqXOu9nwJFFOdL00kFpz42M+4huzYi86vAK1sOOfyOG45muIQ==", "license": "MIT", "dependencies": { "@babel/code-frame": "^7.10.4", @@ -12435,7 +12435,7 @@ "pretty-format": "^27.0.2" }, "engines": { - "node": ">=12" + "node": ">=14" } }, "node_modules/@testing-library/jest-dom": { @@ -12481,25 +12481,6 @@ "react-dom": "^18.0.0" } }, - "node_modules/@testing-library/react/node_modules/@testing-library/dom": { - "version": "9.3.4", - "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-9.3.4.tgz", - "integrity": "sha512-FlS4ZWlp97iiNWig0Muq8p+3rVDjRiYE+YKGbAqXOu9nwJFFOdL00kFpz42M+4huzYi86vAK1sOOfyOG45muIQ==", - "license": "MIT", - "dependencies": { - "@babel/code-frame": "^7.10.4", - "@babel/runtime": "^7.12.5", - "@types/aria-query": "^5.0.1", - "aria-query": "5.1.3", - "chalk": "^4.1.0", - "dom-accessibility-api": "^0.5.9", - "lz-string": "^1.5.0", - "pretty-format": "^27.0.2" - }, - "engines": { - "node": ">=14" - } - }, "node_modules/@testing-library/user-event": { "version": "12.8.3", "resolved": "https://registry.npmjs.org/@testing-library/user-event/-/user-event-12.8.3.tgz", @@ -49080,7 +49061,7 @@ "@babel/preset-react": "^7.28.5", "@babel/preset-typescript": "^7.28.5", "@emotion/styled": "^11.14.1", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", @@ -49120,7 +49101,7 @@ "@ant-design/icons": "^5.2.6", "@emotion/react": "^11.4.1", "@superset-ui/core": "*", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", @@ -49204,7 +49185,7 @@ "@emotion/cache": "^11.4.0", "@emotion/react": "^11.4.1", "@emotion/styled": "^11.14.1", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", @@ -49633,7 +49614,7 @@ "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", @@ -49818,7 +49799,7 @@ "@apache-superset/core": "*", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", diff --git a/superset-frontend/package.json b/superset-frontend/package.json index bb75afbe173..a299fb480d0 100644 --- a/superset-frontend/package.json +++ b/superset-frontend/package.json @@ -271,7 +271,7 @@ "@swc/core": "^1.15.18", "@swc/plugin-emotion": "^14.6.0", "@swc/plugin-transform-imports": "^12.5.0", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "^6.9.1", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "^12.8.3", diff --git a/superset-frontend/packages/superset-core/package.json b/superset-frontend/packages/superset-core/package.json index c8d32b2dfb5..c010fcde246 100644 --- a/superset-frontend/packages/superset-core/package.json +++ b/superset-frontend/packages/superset-core/package.json @@ -81,7 +81,7 @@ "typescript": "^5.0.0", "@emotion/styled": "^11.14.1", "@types/lodash": "^4.17.24", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", diff --git a/superset-frontend/packages/superset-core/src/testing.tsx b/superset-frontend/packages/superset-core/src/testing.tsx index e68186343c9..fba2f353967 100644 --- a/superset-frontend/packages/superset-core/src/testing.tsx +++ b/superset-frontend/packages/superset-core/src/testing.tsx @@ -18,7 +18,7 @@ */ import userEvent from '@testing-library/user-event'; import { ReactElement } from 'react'; -import { render, RenderOptions } from '@testing-library/react'; +import { render, RenderOptions, RenderResult } from '@testing-library/react'; import '@testing-library/jest-dom'; import { themeObject } from './theme'; @@ -33,7 +33,7 @@ const Providers = ({ children }: { children: React.ReactNode }) => ( const customRender = ( ui: ReactElement, options?: Omit, -) => render(ui, { wrapper: Providers, ...options }); +): RenderResult => render(ui, { wrapper: Providers, ...options }); export { createEvent, diff --git a/superset-frontend/packages/superset-ui-chart-controls/package.json b/superset-frontend/packages/superset-ui-chart-controls/package.json index b5f9f8a913f..0ba028e985f 100644 --- a/superset-frontend/packages/superset-ui-chart-controls/package.json +++ b/superset-frontend/packages/superset-ui-chart-controls/package.json @@ -32,7 +32,7 @@ "@ant-design/icons": "^5.2.6", "@emotion/react": "^11.4.1", "@superset-ui/core": "*", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", diff --git a/superset-frontend/packages/superset-ui-core/package.json b/superset-frontend/packages/superset-ui-core/package.json index 1ccc343f8ac..312d6088246 100644 --- a/superset-frontend/packages/superset-ui-core/package.json +++ b/superset-frontend/packages/superset-ui-core/package.json @@ -92,7 +92,7 @@ "@emotion/cache": "^11.4.0", "@emotion/react": "^11.4.1", "@emotion/styled": "^11.14.1", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", diff --git a/superset-frontend/packages/superset-ui-core/src/hooks/useElementOnScreen/useElementOnScreen.test.ts b/superset-frontend/packages/superset-ui-core/src/hooks/useElementOnScreen/useElementOnScreen.test.ts index 56b80067769..7af69f1b3f9 100644 --- a/superset-frontend/packages/superset-ui-core/src/hooks/useElementOnScreen/useElementOnScreen.test.ts +++ b/superset-frontend/packages/superset-ui-core/src/hooks/useElementOnScreen/useElementOnScreen.test.ts @@ -16,7 +16,7 @@ * specific language governing permissions and limitations * under the License. */ -import { renderHook } from '@testing-library/react'; +import { renderHook, act } from '@testing-library/react'; import { useElementOnScreen } from './useElementOnScreen'; const observeMock = jest.fn(); @@ -46,10 +46,9 @@ test('should return isSticky as true when intersectionRatio < 1', async () => { useElementOnScreen({ rootMargin: '-50px 0px 0px 0px' }), ); const callback = IntersectionObserverMock.mock.calls[0][0]; - const callBack = callback([{ isIntersecting: true, intersectionRatio: 0.5 }]); - const observer = new IntersectionObserverMock(callBack, {}); - const newDiv = document.createElement('div'); - observer.observe(newDiv); + act(() => { + callback([{ isIntersecting: true, intersectionRatio: 0.5 }]); + }); expect(hook.result.current[1]).toEqual(true); }); @@ -58,10 +57,9 @@ test('should return isSticky as false when intersectionRatio >= 1', async () => useElementOnScreen({ rootMargin: '-50px 0px 0px 0px' }), ); const callback = IntersectionObserverMock.mock.calls[0][0]; - const callBack = callback([{ isIntersecting: true, intersectionRatio: 1 }]); - const observer = new IntersectionObserverMock(callBack, {}); - const newDiv = document.createElement('div'); - observer.observe(newDiv); + act(() => { + callback([{ isIntersecting: true, intersectionRatio: 1 }]); + }); expect(hook.result.current[1]).toEqual(false); }); diff --git a/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json b/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json index 937155f5414..28e710fdd87 100644 --- a/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json +++ b/superset-frontend/plugins/plugin-chart-ag-grid-table/package.json @@ -39,7 +39,7 @@ "@ant-design/icons": "^5.2.6", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*", diff --git a/superset-frontend/plugins/plugin-chart-table/package.json b/superset-frontend/plugins/plugin-chart-table/package.json index f04005013fc..b0544545a3d 100644 --- a/superset-frontend/plugins/plugin-chart-table/package.json +++ b/superset-frontend/plugins/plugin-chart-table/package.json @@ -40,7 +40,7 @@ "@ant-design/icons": "^5.2.6", "@superset-ui/chart-controls": "*", "@superset-ui/core": "*", - "@testing-library/dom": "^8.20.1", + "@testing-library/dom": "^9.3.4", "@testing-library/jest-dom": "*", "@testing-library/react": "^14.0.0", "@testing-library/user-event": "*",