From 1d027d3f6c0b47910cc0b8285c471e90c5f113a8 Mon Sep 17 00:00:00 2001 From: Brian Ingles Date: Tue, 17 Sep 2024 14:45:55 -0500 Subject: [PATCH] refactor: Split out @deephaven/test-utils package (#2225) - Split out a `@deephaven/test-utils` dev package to remove `jest` dependencies from `@deephaven/utils` resolves #2185 BREAKING CHANGE: TestUtils has been moved to new package `@deephaven-test-utils`. Consumers will need to install the new package as a dev dependency and update references. --- jest.setup.ts | 2 +- package-lock.json | 38 +++++++++++++++++- package.json | 1 + packages/app-utils/package.json | 1 + .../src/components/AppBootstrap.test.tsx | 2 +- packages/app-utils/tsconfig.json | 1 + packages/auth-plugins/package.json | 1 + .../auth-plugins/src/AuthPluginBase.test.tsx | 2 +- .../src/AuthPluginParent.test.tsx | 2 +- packages/auth-plugins/tsconfig.json | 1 + packages/chart/package.json | 1 + packages/chart/src/ChartModelFactory.test.ts | 2 +- packages/chart/src/ChartTheme.test.ts | 2 +- packages/chart/tsconfig.json | 1 + packages/code-studio/package.json | 1 + .../src/main/AppMainContainer.test.tsx | 2 +- .../ColumnSpecificSectionContent.test.tsx | 2 +- packages/code-studio/tsconfig.json | 3 +- packages/components/package.json | 1 + .../components/src/ErrorBoundary.test.tsx | 2 +- packages/components/src/ItemList.test.tsx | 3 +- .../picker/usePickerItemScale.test.ts | 2 +- .../picker/usePickerScrollOnOpen.test.ts | 2 +- .../utils/useRenderNormalizedItem.test.tsx | 2 +- .../src/theme/ThemeProvider.test.tsx | 3 +- .../components/src/theme/ThemeUtils.test.ts | 3 +- .../components/src/theme/useTheme.test.ts | 2 +- packages/components/tsconfig.json | 1 + packages/console/package.json | 3 +- .../console/src/ConsoleStatusBar.test.tsx | 2 +- .../CommandHistoryActions.test.tsx | 2 +- .../console/src/monaco/MonacoUtils.test.ts | 2 +- packages/console/tsconfig.json | 1 + packages/dashboard-core-plugins/package.json | 3 +- .../src/panels/ConsolePanel.test.tsx | 2 +- .../src/panels/FileExplorerPanel.test.tsx | 2 +- .../src/panels/IrisGridPanel.test.tsx | 2 +- .../src/useIrisGridModel.test.ts | 2 +- packages/dashboard-core-plugins/tsconfig.json | 3 +- packages/dashboard/package.json | 1 + .../dashboard/src/layout/useListener.test.ts | 2 +- packages/dashboard/tsconfig.json | 1 + packages/file-explorer/package.json | 3 +- .../file-explorer/src/FileExplorer.test.tsx | 2 +- packages/file-explorer/src/FileList.test.tsx | 2 +- .../src/FileListContainer.test.tsx | 2 +- packages/file-explorer/tsconfig.json | 1 + packages/iris-grid/package.json | 1 + packages/iris-grid/src/IrisGrid.test.tsx | 2 +- .../VisibilityOrderingBuilder.test.tsx | 3 +- packages/iris-grid/tsconfig.json | 1 + packages/jsapi-bootstrap/package.json | 1 + .../src/DeferredApiBootstrap.test.tsx | 2 +- packages/jsapi-bootstrap/src/useApi.test.ts | 2 +- .../src/useDeferredApi.test.ts | 2 +- .../src/useObjectFetcher.test.ts | 2 +- .../jsapi-bootstrap/src/useWidget.test.tsx | 2 +- packages/jsapi-bootstrap/tsconfig.json | 1 + packages/jsapi-components/package.json | 1 + .../src/spectrum/utils/itemUtils.test.tsx | 2 +- .../utils/useItemRowDeserializer.test.ts | 2 +- .../src/useCheckIfExistsValue.test.ts | 2 +- .../src/useDebouncedViewportSearch.test.tsx | 2 +- ...seDebouncedViewportSelectionFilter.test.ts | 3 +- .../src/useFilterConditionFactories.test.ts | 2 +- .../jsapi-components/src/useFormatter.test.ts | 3 +- .../src/useGetItemIndexByValue.test.ts | 2 +- .../src/useGetItemPosition.test.ts | 2 +- .../src/useInitializeViewportData.test.ts | 3 +- .../src/useNotNullOrEmptyFilter.test.ts | 2 +- .../src/usePickerWithSelectedValues.test.ts | 3 +- .../src/useSearchableViewportData.test.ts | 2 +- .../src/useSelectDistinctTable.test.ts | 2 +- .../src/useSetPaddedViewportCallback.test.ts | 2 +- .../src/useShowOnlyEmptyFilter.test.ts | 2 +- .../src/useTableClose.test.ts | 2 +- .../jsapi-components/src/useTableSize.test.ts | 2 +- .../src/useValueFilter.test.ts | 2 +- .../src/useViewportData.test.tsx | 2 +- packages/jsapi-components/tsconfig.json | 3 +- packages/jsapi-utils/package.json | 3 +- packages/jsapi-utils/src/FilterUtils.test.ts | 3 +- .../jsapi-utils/src/FormatterUtils.test.ts | 2 +- packages/jsapi-utils/src/MessageUtils.test.ts | 2 +- packages/jsapi-utils/src/TableUtils.test.ts | 3 +- .../jsapi-utils/src/ViewportDataUtils.test.ts | 2 +- packages/jsapi-utils/tsconfig.json | 1 + packages/react-hooks/package.json | 3 ++ packages/react-hooks/src/ElementUtils.ts | 12 +++++- .../react-hooks/src/SpectrumUtils.test.ts | 3 +- .../react-hooks/src/useAsyncInterval.test.ts | 2 +- .../react-hooks/src/useCheckOverflow.test.ts | 2 +- .../react-hooks/src/useContentRect.test.ts | 2 +- .../useFormWithDetachedSubmitButton.test.ts | 2 +- packages/react-hooks/src/useMappedRef.test.ts | 2 +- .../src/useMappedSelection.test.ts | 3 +- .../useOnScrollOffsetChangeCallback.test.ts | 2 +- .../src/usePopoverOnScrollRef.test.tsx | 2 +- .../src/useSetAttributesCallback.test.ts | 2 +- .../useSpectrumDisableSpellcheckRef.test.ts | 2 +- .../src/useWindowedListData.test.ts | 2 +- packages/react-hooks/tsconfig.json | 6 ++- packages/test-utils/README.md | 9 +++++ packages/test-utils/package.json | 31 ++++++++++++++ .../src/MockProxy.test.ts | 0 .../{utils => test-utils}/src/MockProxy.ts | 0 .../src/TestUtils.test.tsx | 0 .../{utils => test-utils}/src/TestUtils.ts | 2 +- packages/test-utils/src/TypeUtils.ts | 28 +++++++++++++ packages/test-utils/src/index.ts | 1 + packages/test-utils/src/jest.config.cjs | 7 ++++ packages/test-utils/tsconfig.json | 9 +++++ packages/utils/package.json | 3 ++ packages/utils/src/ColorUtils.test.ts | 2 +- packages/utils/src/DOMUtils.test.ts | 2 +- packages/utils/src/TypeUtils.ts | 40 ------------------- packages/utils/src/index.ts | 2 - packages/utils/tsconfig.json | 3 +- 118 files changed, 265 insertions(+), 128 deletions(-) create mode 100644 packages/test-utils/README.md create mode 100644 packages/test-utils/package.json rename packages/{utils => test-utils}/src/MockProxy.test.ts (100%) rename packages/{utils => test-utils}/src/MockProxy.ts (100%) rename packages/{utils => test-utils}/src/TestUtils.test.tsx (100%) rename packages/{utils => test-utils}/src/TestUtils.ts (99%) create mode 100644 packages/test-utils/src/TypeUtils.ts create mode 100644 packages/test-utils/src/index.ts create mode 100644 packages/test-utils/src/jest.config.cjs create mode 100644 packages/test-utils/tsconfig.json diff --git a/jest.setup.ts b/jest.setup.ts index 8db731f817..3aeec7e365 100644 --- a/jest.setup.ts +++ b/jest.setup.ts @@ -4,7 +4,7 @@ import { performance } from 'perf_hooks'; import 'jest-canvas-mock'; import './__mocks__/dh-core'; import Log from '@deephaven/log'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; let logLevel = parseInt(process.env.DH_LOG_LEVEL ?? '', 10); if (!Number.isFinite(logLevel)) { diff --git a/package-lock.json b/package-lock.json index f44ac0d410..885a8644f4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -57,6 +57,7 @@ "@deephaven/prettier-config": "file:../prettier-config", "@deephaven/redux": "file:../redux", "@deephaven/stylelint-config": "file:../stylelint-config", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/tsconfig": "file:../tsconfig", "@deephaven/utils": "file:../utils", "@fortawesome/fontawesome-common-types": "^6.1.1", @@ -2145,6 +2146,10 @@ "resolved": "packages/stylelint-config", "link": true }, + "node_modules/@deephaven/test-utils": { + "resolved": "packages/test-utils", + "link": true + }, "node_modules/@deephaven/tsconfig": { "resolved": "packages/tsconfig", "link": true @@ -29553,6 +29558,7 @@ }, "devDependencies": { "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils", "react-redux": "^7.2.4" }, "engines": { @@ -30255,6 +30261,7 @@ "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils", "deep-equal": "2.2.3" }, "engines": { @@ -30306,6 +30313,7 @@ }, "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", + "@deephaven/test-utils": "file:../test-utils", "react-test-renderer": "^17.0.2" }, "engines": { @@ -30349,7 +30357,8 @@ "nanoid": "^5.0.7" }, "devDependencies": { - "@deephaven/jsapi-shim": "file:../jsapi-shim" + "@deephaven/jsapi-shim": "file:../jsapi-shim", + "@deephaven/test-utils": "file:../test-utils" }, "engines": { "node": ">=16" @@ -30466,6 +30475,9 @@ "lodash.throttle": "^4.1.1", "nanoid": "^5.0.7" }, + "devDependencies": { + "@deephaven/test-utils": "file:../test-utils" + }, "engines": { "node": ">=16" }, @@ -30521,6 +30533,14 @@ "stylelint": "^14.5.1" } }, + "packages/test-utils": { + "name": "@deephaven/test-utils", + "version": "0.93.0", + "license": "Apache-2.0", + "engines": { + "node": ">=16" + } + }, "packages/tsconfig": { "name": "@deephaven/tsconfig", "version": "0.93.0", @@ -30531,6 +30551,9 @@ "name": "@deephaven/utils", "version": "0.93.0", "license": "Apache-2.0", + "devDependencies": { + "@deephaven/test-utils": "file:../test-utils" + }, "engines": { "node": ">=16" } @@ -31970,6 +31993,7 @@ "@deephaven/log": "file:../log", "@deephaven/mocks": "file:../mocks", "@deephaven/react-hooks": "file:../react-hooks", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/utils": "file:../utils", "@fortawesome/fontawesome-svg-core": "^6.2.1", "@fortawesome/react-fontawesome": "^0.2.0", @@ -32479,6 +32503,7 @@ "@deephaven/mocks": "file:../mocks", "@deephaven/react-hooks": "file:../react-hooks", "@deephaven/storage": "file:../storage", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/utils": "file:../utils", "@dnd-kit/core": "^6.1.0", "@dnd-kit/sortable": "^7.0.2", @@ -32520,6 +32545,7 @@ "@deephaven/jsapi-utils": "file:../jsapi-utils", "@deephaven/log": "file:../log", "@deephaven/react-hooks": "file:../react-hooks", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/utils": "file:../utils", "@types/js-cookie": "^3.0.3", "classnames": "^2.3.2", @@ -32548,6 +32574,7 @@ "@deephaven/jsapi-shim": "file:../jsapi-shim", "@deephaven/jsapi-types": "^1.0.0-dev0.34.0", "@deephaven/log": "file:../log", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/utils": "file:../utils", "lodash.clamp": "^4.0.3", "nanoid": "^5.0.7" @@ -32600,6 +32627,7 @@ "requires": { "@adobe/react-spectrum": "3.35.1", "@deephaven/log": "file:../log", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/utils": "file:../utils", "lodash.debounce": "^4.0.8", "lodash.throttle": "^4.1.1", @@ -32633,11 +32661,17 @@ "stylelint-config-standard-scss": "^3.0.0" } }, + "@deephaven/test-utils": { + "version": "file:packages/test-utils" + }, "@deephaven/tsconfig": { "version": "file:packages/tsconfig" }, "@deephaven/utils": { - "version": "file:packages/utils" + "version": "file:packages/utils", + "requires": { + "@deephaven/test-utils": "file:../test-utils" + } }, "@dnd-kit/accessibility": { "version": "3.1.0", diff --git a/package.json b/package.json index 050f70a533..64ec8e2f80 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "@deephaven/prettier-config": "file:../prettier-config", "@deephaven/redux": "file:../redux", "@deephaven/stylelint-config": "file:../stylelint-config", + "@deephaven/test-utils": "file:../test-utils", "@deephaven/tsconfig": "file:../tsconfig", "@deephaven/utils": "file:../utils", "@fortawesome/fontawesome-common-types": "^6.1.1", diff --git a/packages/app-utils/package.json b/packages/app-utils/package.json index cc11fe8280..824b5af5b1 100644 --- a/packages/app-utils/package.json +++ b/packages/app-utils/package.json @@ -22,6 +22,7 @@ "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward" }, "devDependencies": { + "@deephaven/test-utils": "file:../test-utils", "react": "^17.x", "react-dom": "^17.x", "react-redux": "^7.x", diff --git a/packages/app-utils/src/components/AppBootstrap.test.tsx b/packages/app-utils/src/components/AppBootstrap.test.tsx index 1b8b8cfe90..538fbae2a0 100644 --- a/packages/app-utils/src/components/AppBootstrap.test.tsx +++ b/packages/app-utils/src/components/AppBootstrap.test.tsx @@ -9,7 +9,7 @@ import type { IdeConnection, dh as DhType, } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import AppBootstrap from './AppBootstrap'; const { asMock } = TestUtils; diff --git a/packages/app-utils/tsconfig.json b/packages/app-utils/tsconfig.json index ce80fdb657..302b81a309 100644 --- a/packages/app-utils/tsconfig.json +++ b/packages/app-utils/tsconfig.json @@ -21,6 +21,7 @@ { "path": "../plugin" }, { "path": "../react-hooks" }, { "path": "../redux" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/auth-plugins/package.json b/packages/auth-plugins/package.json index e3e13326b0..f0da27c7d0 100644 --- a/packages/auth-plugins/package.json +++ b/packages/auth-plugins/package.json @@ -45,6 +45,7 @@ "js-cookie": "^3.0.5" }, "devDependencies": { + "@deephaven/test-utils": "file:../test-utils", "@types/react": "^17.0.2" }, "peerDependencies": { diff --git a/packages/auth-plugins/src/AuthPluginBase.test.tsx b/packages/auth-plugins/src/AuthPluginBase.test.tsx index 77440b2b8e..f48c9d4348 100644 --- a/packages/auth-plugins/src/AuthPluginBase.test.tsx +++ b/packages/auth-plugins/src/AuthPluginBase.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { act, render, screen } from '@testing-library/react'; import { ClientContext } from '@deephaven/jsapi-bootstrap'; import type { CoreClient } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import AuthPluginBase from './AuthPluginBase'; const mockChildText = 'Mock Auth Base Child'; diff --git a/packages/auth-plugins/src/AuthPluginParent.test.tsx b/packages/auth-plugins/src/AuthPluginParent.test.tsx index f4c18b5068..5a30ba33fe 100644 --- a/packages/auth-plugins/src/AuthPluginParent.test.tsx +++ b/packages/auth-plugins/src/AuthPluginParent.test.tsx @@ -3,7 +3,7 @@ import { act, render, screen } from '@testing-library/react'; import { ApiContext, ClientContext } from '@deephaven/jsapi-bootstrap'; import { dh } from '@deephaven/jsapi-shim'; import type { CoreClient, LoginOptions } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import AuthPluginParent from './AuthPluginParent'; import { AuthConfigMap } from './AuthPlugin'; diff --git a/packages/auth-plugins/tsconfig.json b/packages/auth-plugins/tsconfig.json index 3e22eed945..cf0a8bf862 100644 --- a/packages/auth-plugins/tsconfig.json +++ b/packages/auth-plugins/tsconfig.json @@ -13,6 +13,7 @@ { "path": "../jsapi-utils" }, { "path": "../log" }, { "path": "../redux" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/chart/package.json b/packages/chart/package.json index 6ee615f91f..51e387903d 100644 --- a/packages/chart/package.json +++ b/packages/chart/package.json @@ -50,6 +50,7 @@ "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils", "@types/plotly.js": "^2.12.11" }, "files": [ diff --git a/packages/chart/src/ChartModelFactory.test.ts b/packages/chart/src/ChartModelFactory.test.ts index 6cabb63321..f431adc291 100644 --- a/packages/chart/src/ChartModelFactory.test.ts +++ b/packages/chart/src/ChartModelFactory.test.ts @@ -1,5 +1,5 @@ import dh from '@deephaven/jsapi-shim'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import ChartModelFactory from './ChartModelFactory'; import type { ChartTheme } from './ChartTheme'; import FigureChartModel from './FigureChartModel'; diff --git a/packages/chart/src/ChartTheme.test.ts b/packages/chart/src/ChartTheme.test.ts index f7c6387946..ce5340972e 100644 --- a/packages/chart/src/ChartTheme.test.ts +++ b/packages/chart/src/ChartTheme.test.ts @@ -1,6 +1,6 @@ /// -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { resolveCssVariablesInRecord } from '@deephaven/components'; import { defaultChartTheme } from './ChartTheme'; import chartThemeRaw from './ChartTheme.module.scss'; diff --git a/packages/chart/tsconfig.json b/packages/chart/tsconfig.json index a062e3e232..0533a1ffed 100644 --- a/packages/chart/tsconfig.json +++ b/packages/chart/tsconfig.json @@ -12,6 +12,7 @@ { "path": "../jsapi-utils" }, { "path": "../log" }, { "path": "../react-hooks" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/code-studio/package.json b/packages/code-studio/package.json index d442b36205..acce1af3cf 100644 --- a/packages/code-studio/package.json +++ b/packages/code-studio/package.json @@ -78,6 +78,7 @@ "@deephaven/mocks": "file:../mocks", "@deephaven/prettier-config": "file:../prettier-config", "@deephaven/stylelint-config": "file:../stylelint-config", + "@deephaven/test-utils": "file:../test-utils", "autoprefixer": "^10.4.8" }, "publishConfig": { diff --git a/packages/code-studio/src/main/AppMainContainer.test.tsx b/packages/code-studio/src/main/AppMainContainer.test.tsx index 564f3643c7..6f99090981 100644 --- a/packages/code-studio/src/main/AppMainContainer.test.tsx +++ b/packages/code-studio/src/main/AppMainContainer.test.tsx @@ -19,7 +19,7 @@ import type { IdeSession, VariableChanges, } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { Workspace, createMockStore } from '@deephaven/redux'; import userEvent from '@testing-library/user-event'; import { DEFAULT_DASHBOARD_ID } from '@deephaven/dashboard'; diff --git a/packages/code-studio/src/settings/ColumnSpecificSectionContent.test.tsx b/packages/code-studio/src/settings/ColumnSpecificSectionContent.test.tsx index 54463459a5..614bf3cca8 100644 --- a/packages/code-studio/src/settings/ColumnSpecificSectionContent.test.tsx +++ b/packages/code-studio/src/settings/ColumnSpecificSectionContent.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { Formatter } from '@deephaven/jsapi-utils'; import { ApiContext } from '@deephaven/jsapi-bootstrap'; import dh from '@deephaven/jsapi-shim'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { ColumnSpecificSectionContent, ColumnSpecificSectionContentProps, diff --git a/packages/code-studio/tsconfig.json b/packages/code-studio/tsconfig.json index ab01ecd77a..80a30194e6 100644 --- a/packages/code-studio/tsconfig.json +++ b/packages/code-studio/tsconfig.json @@ -32,6 +32,7 @@ { "path": "../redux" }, { "path": "../storage" }, { "path": "../utils" }, - { "path": "../filters" } + { "path": "../filters" }, + { "path": "../test-utils" } ] } diff --git a/packages/components/package.json b/packages/components/package.json index 00639a150d..23668d9158 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -59,6 +59,7 @@ }, "devDependencies": { "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils", "react-redux": "^7.2.4" }, "files": [ diff --git a/packages/components/src/ErrorBoundary.test.tsx b/packages/components/src/ErrorBoundary.test.tsx index 9bacb698ee..0c03ef7def 100644 --- a/packages/components/src/ErrorBoundary.test.tsx +++ b/packages/components/src/ErrorBoundary.test.tsx @@ -1,6 +1,6 @@ import React from 'react'; import { render } from '@testing-library/react'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import ErrorBoundary, { ErrorBoundaryProps } from './ErrorBoundary'; function ThrowComponent(): JSX.Element { diff --git a/packages/components/src/ItemList.test.tsx b/packages/components/src/ItemList.test.tsx index 64ffae022b..a520f9d77b 100644 --- a/packages/components/src/ItemList.test.tsx +++ b/packages/components/src/ItemList.test.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { Range, TestUtils, ClickOptions } from '@deephaven/utils'; +import { Range } from '@deephaven/utils'; +import { ClickOptions, TestUtils } from '@deephaven/test-utils'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import ItemList from './ItemList'; diff --git a/packages/components/src/spectrum/picker/usePickerItemScale.test.ts b/packages/components/src/spectrum/picker/usePickerItemScale.test.ts index ae00cd5f8a..f5a56a0c25 100644 --- a/packages/components/src/spectrum/picker/usePickerItemScale.test.ts +++ b/packages/components/src/spectrum/picker/usePickerItemScale.test.ts @@ -1,4 +1,4 @@ -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import type { ProviderContext } from '@react-types/provider'; import { renderHook } from '@testing-library/react-hooks'; import { useSpectrumThemeProvider } from '../../theme'; diff --git a/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts b/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts index fa829ce5d2..77f48d09cf 100644 --- a/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts +++ b/packages/components/src/spectrum/picker/usePickerScrollOnOpen.test.ts @@ -1,5 +1,5 @@ import { renderHook } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { findSpectrumPickerScrollArea, usePopoverOnScrollRef, diff --git a/packages/components/src/spectrum/utils/useRenderNormalizedItem.test.tsx b/packages/components/src/spectrum/utils/useRenderNormalizedItem.test.tsx index 18e7433aff..e5e2dc46ba 100644 --- a/packages/components/src/spectrum/utils/useRenderNormalizedItem.test.tsx +++ b/packages/components/src/spectrum/utils/useRenderNormalizedItem.test.tsx @@ -2,7 +2,7 @@ import React, { Key } from 'react'; import { Item } from '@adobe/react-spectrum'; import { renderHook } from '@testing-library/react-hooks'; import { isElementOfType } from '@deephaven/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { ItemContent } from '../ItemContent'; import { useRenderNormalizedItem } from './useRenderNormalizedItem'; import { getItemKey, NormalizedItem } from './itemUtils'; diff --git a/packages/components/src/theme/ThemeProvider.test.tsx b/packages/components/src/theme/ThemeProvider.test.tsx index fdc4438d9e..87e3fef5a5 100644 --- a/packages/components/src/theme/ThemeProvider.test.tsx +++ b/packages/components/src/theme/ThemeProvider.test.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { act, render } from '@testing-library/react'; -import { assertNotNull, TestUtils } from '@deephaven/utils'; +import { assertNotNull } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { ThemeContextValue, ThemeProvider } from './ThemeProvider'; import { DEFAULT_LIGHT_THEME_KEY, ThemeData } from './ThemeModel'; import { diff --git a/packages/components/src/theme/ThemeUtils.test.ts b/packages/components/src/theme/ThemeUtils.test.ts index 42b17c2dc3..281e9b015e 100644 --- a/packages/components/src/theme/ThemeUtils.test.ts +++ b/packages/components/src/theme/ThemeUtils.test.ts @@ -1,7 +1,8 @@ import fs from 'fs'; import path from 'path'; -import { ColorUtils, TestUtils } from '@deephaven/utils'; +import { ColorUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { DEFAULT_DARK_THEME_KEY, DEFAULT_PRELOAD_DATA_VARIABLES, diff --git a/packages/components/src/theme/useTheme.test.ts b/packages/components/src/theme/useTheme.test.ts index 60a9329d3d..78de6024e3 100644 --- a/packages/components/src/theme/useTheme.test.ts +++ b/packages/components/src/theme/useTheme.test.ts @@ -1,6 +1,6 @@ import { useContext } from 'react'; import { renderHook } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useTheme } from './useTheme'; const { asMock } = TestUtils; diff --git a/packages/components/tsconfig.json b/packages/components/tsconfig.json index a3f2bd3c24..740b29b6f3 100644 --- a/packages/components/tsconfig.json +++ b/packages/components/tsconfig.json @@ -9,6 +9,7 @@ "references": [ { "path": "../log" }, { "path": "../react-hooks" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/console/package.json b/packages/console/package.json index b39a1a9707..4e4546b81a 100644 --- a/packages/console/package.json +++ b/packages/console/package.json @@ -52,7 +52,8 @@ }, "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", - "@deephaven/mocks": "file:../mocks" + "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils" }, "files": [ "dist" diff --git a/packages/console/src/ConsoleStatusBar.test.tsx b/packages/console/src/ConsoleStatusBar.test.tsx index 8d668c3a7d..44dfb92efc 100644 --- a/packages/console/src/ConsoleStatusBar.test.tsx +++ b/packages/console/src/ConsoleStatusBar.test.tsx @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react'; import dh from '@deephaven/jsapi-shim'; import { ContextActions, DropdownActions } from '@deephaven/components'; import { vsCheck } from '@deephaven/icons'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import userEvent from '@testing-library/user-event'; import ConsoleStatusBar from './ConsoleStatusBar'; diff --git a/packages/console/src/command-history/CommandHistoryActions.test.tsx b/packages/console/src/command-history/CommandHistoryActions.test.tsx index d54433fe4b..7395cb64ae 100644 --- a/packages/console/src/command-history/CommandHistoryActions.test.tsx +++ b/packages/console/src/command-history/CommandHistoryActions.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import CommandHistoryActions from './CommandHistoryActions'; const { asMock } = TestUtils; diff --git a/packages/console/src/monaco/MonacoUtils.test.ts b/packages/console/src/monaco/MonacoUtils.test.ts index 85cdea53ba..915334197c 100644 --- a/packages/console/src/monaco/MonacoUtils.test.ts +++ b/packages/console/src/monaco/MonacoUtils.test.ts @@ -1,7 +1,7 @@ /* eslint-disable no-bitwise */ import * as monaco from 'monaco-editor'; import { Shortcut, KEY, MODIFIER } from '@deephaven/components'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import MonacoUtils from './MonacoUtils'; const { asMock, createMockProxy } = TestUtils; diff --git a/packages/console/tsconfig.json b/packages/console/tsconfig.json index 8d62af0f02..a1c28753d0 100644 --- a/packages/console/tsconfig.json +++ b/packages/console/tsconfig.json @@ -13,6 +13,7 @@ { "path": "../jsapi-shim" }, { "path": "../log" }, { "path": "../storage" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/dashboard-core-plugins/package.json b/packages/dashboard-core-plugins/package.json index 6bc01e4eea..87feb0e1ee 100644 --- a/packages/dashboard-core-plugins/package.json +++ b/packages/dashboard-core-plugins/package.json @@ -66,7 +66,8 @@ }, "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", - "@deephaven/mocks": "file:../mocks" + "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils" }, "files": [ "dist", diff --git a/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx b/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx index 66159d6e3f..92e90c214d 100644 --- a/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/ConsolePanel.test.tsx @@ -5,7 +5,7 @@ import type { Container, EventEmitter } from '@deephaven/golden-layout'; import type { IdeConnection, IdeSession } from '@deephaven/jsapi-types'; import { dh } from '@deephaven/jsapi-shim'; import { SessionConfig, SessionWrapper } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { ConsolePanel } from './ConsolePanel'; type IdeSessionConstructor = new (language: string) => IdeSession; diff --git a/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.test.tsx index 81dfa0d14a..c491068a7b 100644 --- a/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/FileExplorerPanel.test.tsx @@ -12,7 +12,7 @@ import { FileStorageItem, } from '@deephaven/file-explorer'; import type { Container } from '@deephaven/golden-layout'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { FileExplorerPanel, FileExplorerPanelProps } from './FileExplorerPanel'; import MockFileStorage from './MockFileStorage'; diff --git a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx index ea4d107fe4..53e8a14b5d 100644 --- a/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx +++ b/packages/dashboard-core-plugins/src/panels/IrisGridPanel.test.tsx @@ -4,7 +4,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; import { IrisGridModelFactory } from '@deephaven/iris-grid'; import dh from '@deephaven/jsapi-shim'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import type { Container } from '@deephaven/golden-layout'; import { Workspace } from '@deephaven/redux'; import { IrisGridPanel } from './IrisGridPanel'; diff --git a/packages/dashboard-core-plugins/src/useIrisGridModel.test.ts b/packages/dashboard-core-plugins/src/useIrisGridModel.test.ts index 2dc2002642..02a6224b6b 100644 --- a/packages/dashboard-core-plugins/src/useIrisGridModel.test.ts +++ b/packages/dashboard-core-plugins/src/useIrisGridModel.test.ts @@ -1,6 +1,6 @@ import { IrisGridModel } from '@deephaven/iris-grid'; import { type dh } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { renderHook } from '@testing-library/react-hooks'; import { act } from 'react-test-renderer'; import { diff --git a/packages/dashboard-core-plugins/tsconfig.json b/packages/dashboard-core-plugins/tsconfig.json index 20ae9f1ef7..3f2dedd4e7 100644 --- a/packages/dashboard-core-plugins/tsconfig.json +++ b/packages/dashboard-core-plugins/tsconfig.json @@ -22,6 +22,7 @@ { "path": "../log" }, { "path": "../react-hooks" }, { "path": "../redux" }, - { "path": "../plugin" } + { "path": "../plugin" }, + { "path": "../test-utils" } ] } diff --git a/packages/dashboard/package.json b/packages/dashboard/package.json index 828ef0e8b4..813003b6af 100644 --- a/packages/dashboard/package.json +++ b/packages/dashboard/package.json @@ -41,6 +41,7 @@ }, "devDependencies": { "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils", "@types/lodash.ismatch": "^4.4.0" }, "files": [ diff --git a/packages/dashboard/src/layout/useListener.test.ts b/packages/dashboard/src/layout/useListener.test.ts index 4c1f9e5fe4..26a1fe1cd6 100644 --- a/packages/dashboard/src/layout/useListener.test.ts +++ b/packages/dashboard/src/layout/useListener.test.ts @@ -1,5 +1,5 @@ import { EventEmitter } from '@deephaven/golden-layout'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { renderHook } from '@testing-library/react-hooks'; import useListener from './useListener'; diff --git a/packages/dashboard/tsconfig.json b/packages/dashboard/tsconfig.json index 0095b98b5b..73feeb341e 100644 --- a/packages/dashboard/tsconfig.json +++ b/packages/dashboard/tsconfig.json @@ -12,6 +12,7 @@ { "path": "../log" }, { "path": "../react-hooks" }, { "path": "../redux" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/file-explorer/package.json b/packages/file-explorer/package.json index 02e1972416..8c1796bcd2 100644 --- a/packages/file-explorer/package.json +++ b/packages/file-explorer/package.json @@ -37,7 +37,8 @@ "react": ">=16.8.0" }, "devDependencies": { - "@deephaven/mocks": "file:../mocks" + "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils" }, "files": [ "dist" diff --git a/packages/file-explorer/src/FileExplorer.test.tsx b/packages/file-explorer/src/FileExplorer.test.tsx index e3a4f4d35e..bbe2e9b31c 100644 --- a/packages/file-explorer/src/FileExplorer.test.tsx +++ b/packages/file-explorer/src/FileExplorer.test.tsx @@ -7,7 +7,7 @@ import { import userEvent from '@testing-library/user-event/'; import { MockFileStorage } from '@deephaven/dashboard-core-plugins'; import { ContextMenuRoot } from '@deephaven/components'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import FileStorage, { DirectoryStorageItem, FileStorageItem, diff --git a/packages/file-explorer/src/FileList.test.tsx b/packages/file-explorer/src/FileList.test.tsx index 811c10e7a4..bebcf80342 100644 --- a/packages/file-explorer/src/FileList.test.tsx +++ b/packages/file-explorer/src/FileList.test.tsx @@ -3,7 +3,7 @@ import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { MockFileStorage } from '@deephaven/dashboard-core-plugins'; import { ContextMenuRoot } from '@deephaven/components'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { DirectoryStorageItem, FileStorageItem, diff --git a/packages/file-explorer/src/FileListContainer.test.tsx b/packages/file-explorer/src/FileListContainer.test.tsx index c248443499..c26af77927 100644 --- a/packages/file-explorer/src/FileListContainer.test.tsx +++ b/packages/file-explorer/src/FileListContainer.test.tsx @@ -2,7 +2,7 @@ import React from 'react'; import { screen, render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { MockFileStorage } from '@deephaven/dashboard-core-plugins'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { ContextMenuRoot } from '@deephaven/components'; import { FileStorageItem, FileStorageTable } from './FileStorage'; import FileListContainer, { FileListContainerProps } from './FileListContainer'; diff --git a/packages/file-explorer/tsconfig.json b/packages/file-explorer/tsconfig.json index 48a48416ad..1ad411946d 100644 --- a/packages/file-explorer/tsconfig.json +++ b/packages/file-explorer/tsconfig.json @@ -16,6 +16,7 @@ { "path": "../storage" }, + { "path": "../test-utils" }, { "path": "../utils" } diff --git a/packages/iris-grid/package.json b/packages/iris-grid/package.json index 7b7becd111..9cfdc3c12f 100644 --- a/packages/iris-grid/package.json +++ b/packages/iris-grid/package.json @@ -67,6 +67,7 @@ "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", "@deephaven/mocks": "file:../mocks", + "@deephaven/test-utils": "file:../test-utils", "deep-equal": "2.2.3" }, "files": [ diff --git a/packages/iris-grid/src/IrisGrid.test.tsx b/packages/iris-grid/src/IrisGrid.test.tsx index 24d58e7219..1f7e0d5121 100644 --- a/packages/iris-grid/src/IrisGrid.test.tsx +++ b/packages/iris-grid/src/IrisGrid.test.tsx @@ -2,7 +2,7 @@ import React, { ReactElement } from 'react'; import TestRenderer from 'react-test-renderer'; import dh from '@deephaven/jsapi-shim'; import { DateUtils, Settings } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { TypeValue } from '@deephaven/filters'; import IrisGrid from './IrisGrid'; import IrisGridTestUtils from './IrisGridTestUtils'; diff --git a/packages/iris-grid/src/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.test.tsx b/packages/iris-grid/src/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.test.tsx index 9816585fcd..711bf572ab 100644 --- a/packages/iris-grid/src/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.test.tsx +++ b/packages/iris-grid/src/sidebar/visibility-ordering-builder/VisibilityOrderingBuilder.test.tsx @@ -3,7 +3,8 @@ import { fireEvent, render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { GridUtils } from '@deephaven/grid'; import type { MoveOperation } from '@deephaven/grid'; -import { assertNotNull, TestUtils } from '@deephaven/utils'; +import { assertNotNull } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import dh from '@deephaven/jsapi-shim'; import type { ColumnGroup } from '@deephaven/jsapi-types'; import VisibilityOrderingBuilder from './VisibilityOrderingBuilder'; diff --git a/packages/iris-grid/tsconfig.json b/packages/iris-grid/tsconfig.json index a7b42e12ab..32980635cd 100644 --- a/packages/iris-grid/tsconfig.json +++ b/packages/iris-grid/tsconfig.json @@ -17,6 +17,7 @@ { "path": "../log" }, { "path": "../react-hooks" }, { "path": "../storage" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/jsapi-bootstrap/package.json b/packages/jsapi-bootstrap/package.json index 1a368b222a..c5d4a9bac6 100644 --- a/packages/jsapi-bootstrap/package.json +++ b/packages/jsapi-bootstrap/package.json @@ -29,6 +29,7 @@ "@deephaven/utils": "file:../utils" }, "devDependencies": { + "@deephaven/test-utils": "file:../test-utils", "react": "^17.x" }, "peerDependencies": { diff --git a/packages/jsapi-bootstrap/src/DeferredApiBootstrap.test.tsx b/packages/jsapi-bootstrap/src/DeferredApiBootstrap.test.tsx index 281ea2db47..c466429927 100644 --- a/packages/jsapi-bootstrap/src/DeferredApiBootstrap.test.tsx +++ b/packages/jsapi-bootstrap/src/DeferredApiBootstrap.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { act, render } from '@testing-library/react'; import type { dh as DhType } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import DeferredApiBootstrap from './DeferredApiBootstrap'; import { DeferredApiContext } from './useDeferredApi'; diff --git a/packages/jsapi-bootstrap/src/useApi.test.ts b/packages/jsapi-bootstrap/src/useApi.test.ts index 289a0e700f..0ce099c559 100644 --- a/packages/jsapi-bootstrap/src/useApi.test.ts +++ b/packages/jsapi-bootstrap/src/useApi.test.ts @@ -1,7 +1,7 @@ import { renderHook } from '@testing-library/react-hooks'; import dh from '@deephaven/jsapi-shim'; import { useContext } from 'react'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useApi } from './useApi'; const { asMock } = TestUtils; diff --git a/packages/jsapi-bootstrap/src/useDeferredApi.test.ts b/packages/jsapi-bootstrap/src/useDeferredApi.test.ts index 1f3f3dc2b2..3c14cc0b75 100644 --- a/packages/jsapi-bootstrap/src/useDeferredApi.test.ts +++ b/packages/jsapi-bootstrap/src/useDeferredApi.test.ts @@ -1,7 +1,7 @@ import { act, renderHook } from '@testing-library/react-hooks'; import type { dh as DhType } from '@deephaven/jsapi-types'; import { useContext } from 'react'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useDeferredApi } from './useDeferredApi'; import { VariableDescriptor } from './useObjectFetcher'; diff --git a/packages/jsapi-bootstrap/src/useObjectFetcher.test.ts b/packages/jsapi-bootstrap/src/useObjectFetcher.test.ts index 52f441b362..2855501eeb 100644 --- a/packages/jsapi-bootstrap/src/useObjectFetcher.test.ts +++ b/packages/jsapi-bootstrap/src/useObjectFetcher.test.ts @@ -1,6 +1,6 @@ import { act, renderHook } from '@testing-library/react-hooks'; import { useContext } from 'react'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { getVariableDescriptor, sanitizeVariableDescriptor, diff --git a/packages/jsapi-bootstrap/src/useWidget.test.tsx b/packages/jsapi-bootstrap/src/useWidget.test.tsx index f6221b04da..03338b5779 100644 --- a/packages/jsapi-bootstrap/src/useWidget.test.tsx +++ b/packages/jsapi-bootstrap/src/useWidget.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { act, renderHook } from '@testing-library/react-hooks'; import { dh } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useWidget } from './useWidget'; import { ObjectFetchManagerContext } from './useObjectFetch'; diff --git a/packages/jsapi-bootstrap/tsconfig.json b/packages/jsapi-bootstrap/tsconfig.json index 7c57a9efe0..e8d52756d5 100644 --- a/packages/jsapi-bootstrap/tsconfig.json +++ b/packages/jsapi-bootstrap/tsconfig.json @@ -10,6 +10,7 @@ { "path": "../components" }, { "path": "../log" }, { "path": "../react-hooks" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/jsapi-components/package.json b/packages/jsapi-components/package.json index 354feafc90..bea7ec1cfa 100644 --- a/packages/jsapi-components/package.json +++ b/packages/jsapi-components/package.json @@ -37,6 +37,7 @@ }, "devDependencies": { "@deephaven/jsapi-shim": "file:../jsapi-shim", + "@deephaven/test-utils": "file:../test-utils", "react-test-renderer": "^17.0.2" }, "peerDependencies": { diff --git a/packages/jsapi-components/src/spectrum/utils/itemUtils.test.tsx b/packages/jsapi-components/src/spectrum/utils/itemUtils.test.tsx index 6e9ca57e3b..a20b14b1a6 100644 --- a/packages/jsapi-components/src/spectrum/utils/itemUtils.test.tsx +++ b/packages/jsapi-components/src/spectrum/utils/itemUtils.test.tsx @@ -1,5 +1,5 @@ import { type dh } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { getItemKeyColumn, getItemLabelColumn } from './itemUtils'; const { createMockProxy } = TestUtils; diff --git a/packages/jsapi-components/src/spectrum/utils/useItemRowDeserializer.test.ts b/packages/jsapi-components/src/spectrum/utils/useItemRowDeserializer.test.ts index 1d0bff5fff..000bfa8411 100644 --- a/packages/jsapi-components/src/spectrum/utils/useItemRowDeserializer.test.ts +++ b/packages/jsapi-components/src/spectrum/utils/useItemRowDeserializer.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import type { dh } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useItemRowDeserializer } from './useItemRowDeserializer'; import { getItemKeyColumn, getItemLabelColumn } from './itemUtils'; diff --git a/packages/jsapi-components/src/useCheckIfExistsValue.test.ts b/packages/jsapi-components/src/useCheckIfExistsValue.test.ts index 27bc790a3e..3172da4a59 100644 --- a/packages/jsapi-components/src/useCheckIfExistsValue.test.ts +++ b/packages/jsapi-components/src/useCheckIfExistsValue.test.ts @@ -1,7 +1,7 @@ import { act, renderHook } from '@testing-library/react-hooks'; import type { Table } from '@deephaven/jsapi-types'; import { TableUtils } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useCheckIfExistsValue from './useCheckIfExistsValue'; import useTableUtils from './useTableUtils'; diff --git a/packages/jsapi-components/src/useDebouncedViewportSearch.test.tsx b/packages/jsapi-components/src/useDebouncedViewportSearch.test.tsx index 694f99ef21..71d64572dd 100644 --- a/packages/jsapi-components/src/useDebouncedViewportSearch.test.tsx +++ b/packages/jsapi-components/src/useDebouncedViewportSearch.test.tsx @@ -7,7 +7,7 @@ import type { } from '@deephaven/jsapi-types'; import dh from '@deephaven/jsapi-shim'; import { TableUtils } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useDebouncedViewportSearch, { DEBOUNCE_VIEWPORT_SEARCH_MS, } from './useDebouncedViewportSearch'; diff --git a/packages/jsapi-components/src/useDebouncedViewportSelectionFilter.test.ts b/packages/jsapi-components/src/useDebouncedViewportSelectionFilter.test.ts index 8e27c6bb6b..67fed3d064 100644 --- a/packages/jsapi-components/src/useDebouncedViewportSelectionFilter.test.ts +++ b/packages/jsapi-components/src/useDebouncedViewportSelectionFilter.test.ts @@ -12,7 +12,8 @@ import { useMappedSelection, WindowedListData, } from '@deephaven/react-hooks'; -import { KeyedItem, TestUtils } from '@deephaven/utils'; +import { KeyedItem } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useDebouncedViewportSelectionFilter, { DEBOUNCE_MS, } from './useDebouncedViewportSelectionFilter'; diff --git a/packages/jsapi-components/src/useFilterConditionFactories.test.ts b/packages/jsapi-components/src/useFilterConditionFactories.test.ts index 65c9f0aba4..fa3ea29d99 100644 --- a/packages/jsapi-components/src/useFilterConditionFactories.test.ts +++ b/packages/jsapi-components/src/useFilterConditionFactories.test.ts @@ -1,7 +1,7 @@ import { renderHook } from '@testing-library/react-hooks'; import type { FilterCondition, Table } from '@deephaven/jsapi-types'; import { FilterConditionFactory } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useFilterConditionFactories from './useFilterConditionFactories'; const { asMock, createMockProxy } = TestUtils; diff --git a/packages/jsapi-components/src/useFormatter.test.ts b/packages/jsapi-components/src/useFormatter.test.ts index c39a531f3e..ad1329b6bb 100644 --- a/packages/jsapi-components/src/useFormatter.test.ts +++ b/packages/jsapi-components/src/useFormatter.test.ts @@ -1,5 +1,6 @@ import { useApi } from '@deephaven/jsapi-bootstrap'; -import { bindAllMethods, TestUtils } from '@deephaven/utils'; +import { bindAllMethods } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { createFormatterFromSettings, Formatter, diff --git a/packages/jsapi-components/src/useGetItemIndexByValue.test.ts b/packages/jsapi-components/src/useGetItemIndexByValue.test.ts index e21d200523..8a9c6efdf0 100644 --- a/packages/jsapi-components/src/useGetItemIndexByValue.test.ts +++ b/packages/jsapi-components/src/useGetItemIndexByValue.test.ts @@ -1,7 +1,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { dh } from '@deephaven/jsapi-types'; import { TableUtils } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useGetItemIndexByValue } from './useGetItemIndexByValue'; import { useTableUtils } from './useTableUtils'; diff --git a/packages/jsapi-components/src/useGetItemPosition.test.ts b/packages/jsapi-components/src/useGetItemPosition.test.ts index 8399b0dabf..201dc2f38a 100644 --- a/packages/jsapi-components/src/useGetItemPosition.test.ts +++ b/packages/jsapi-components/src/useGetItemPosition.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import type { Column, Table } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useGetItemPosition, { UseGetItemPositionOptions, } from './useGetItemPosition'; diff --git a/packages/jsapi-components/src/useInitializeViewportData.test.ts b/packages/jsapi-components/src/useInitializeViewportData.test.ts index c3297b860f..6ec1a30812 100644 --- a/packages/jsapi-components/src/useInitializeViewportData.test.ts +++ b/packages/jsapi-components/src/useInitializeViewportData.test.ts @@ -2,7 +2,8 @@ import { act, renderHook } from '@testing-library/react-hooks'; import type { dh } from '@deephaven/jsapi-types'; import { generateEmptyKeyedItems } from '@deephaven/jsapi-utils'; import { WindowedListData } from '@deephaven/react-hooks'; -import { ITEM_KEY_PREFIX, KeyedItem, TestUtils } from '@deephaven/utils'; +import { ITEM_KEY_PREFIX, KeyedItem } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useInitializeViewportData from './useInitializeViewportData'; import useTableSize from './useTableSize'; diff --git a/packages/jsapi-components/src/useNotNullOrEmptyFilter.test.ts b/packages/jsapi-components/src/useNotNullOrEmptyFilter.test.ts index 228aa00775..1c7a660a66 100644 --- a/packages/jsapi-components/src/useNotNullOrEmptyFilter.test.ts +++ b/packages/jsapi-components/src/useNotNullOrEmptyFilter.test.ts @@ -6,7 +6,7 @@ import { FilterConditionFactory, TableUtils, } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useNotNullOrEmptyFilter from './useNotNullOrEmptyFilter'; import useTableUtils from './useTableUtils'; diff --git a/packages/jsapi-components/src/usePickerWithSelectedValues.test.ts b/packages/jsapi-components/src/usePickerWithSelectedValues.test.ts index 6db84d1d55..ba0f51c3d1 100644 --- a/packages/jsapi-components/src/usePickerWithSelectedValues.test.ts +++ b/packages/jsapi-components/src/usePickerWithSelectedValues.test.ts @@ -11,7 +11,8 @@ import { useDebouncedValue, type WindowedListData, } from '@deephaven/react-hooks'; -import { KeyedItem, TestUtils } from '@deephaven/utils'; +import { KeyedItem } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import usePickerWithSelectedValues from './usePickerWithSelectedValues'; import useViewportData, { UseViewportDataResult } from './useViewportData'; import useViewportFilter from './useViewportFilter'; diff --git a/packages/jsapi-components/src/useSearchableViewportData.test.ts b/packages/jsapi-components/src/useSearchableViewportData.test.ts index d09cea957e..e10a72369f 100644 --- a/packages/jsapi-components/src/useSearchableViewportData.test.ts +++ b/packages/jsapi-components/src/useSearchableViewportData.test.ts @@ -8,7 +8,7 @@ import { TableUtils, } from '@deephaven/jsapi-utils'; import { useDebouncedCallback } from '@deephaven/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useSearchableViewportData from './useSearchableViewportData'; import useViewportData, { UseViewportDataResult } from './useViewportData'; import useTableUtils from './useTableUtils'; diff --git a/packages/jsapi-components/src/useSelectDistinctTable.test.ts b/packages/jsapi-components/src/useSelectDistinctTable.test.ts index 17636f5d01..df3a61686f 100644 --- a/packages/jsapi-components/src/useSelectDistinctTable.test.ts +++ b/packages/jsapi-components/src/useSelectDistinctTable.test.ts @@ -1,5 +1,5 @@ import type { Table } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { renderHook } from '@testing-library/react-hooks'; import useSelectDistinctTable from './useSelectDistinctTable'; diff --git a/packages/jsapi-components/src/useSetPaddedViewportCallback.test.ts b/packages/jsapi-components/src/useSetPaddedViewportCallback.test.ts index d81ba63560..6dcd73f6be 100644 --- a/packages/jsapi-components/src/useSetPaddedViewportCallback.test.ts +++ b/packages/jsapi-components/src/useSetPaddedViewportCallback.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import type { Table } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useSetPaddedViewportCallback from './useSetPaddedViewportCallback'; beforeEach(() => { diff --git a/packages/jsapi-components/src/useShowOnlyEmptyFilter.test.ts b/packages/jsapi-components/src/useShowOnlyEmptyFilter.test.ts index f7d08fed01..36a6e1aa41 100644 --- a/packages/jsapi-components/src/useShowOnlyEmptyFilter.test.ts +++ b/packages/jsapi-components/src/useShowOnlyEmptyFilter.test.ts @@ -5,7 +5,7 @@ import { createShowOnlyEmptyFilterCondition, TableUtils, } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useShowOnlyEmptyFilter from './useShowOnlyEmptyFilter'; import useTableUtils from './useTableUtils'; diff --git a/packages/jsapi-components/src/useTableClose.test.ts b/packages/jsapi-components/src/useTableClose.test.ts index 16bb4f109f..64a5fdb79b 100644 --- a/packages/jsapi-components/src/useTableClose.test.ts +++ b/packages/jsapi-components/src/useTableClose.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import type { dh } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useTableClose from './useTableClose'; const table = TestUtils.createMockProxy({}); diff --git a/packages/jsapi-components/src/useTableSize.test.ts b/packages/jsapi-components/src/useTableSize.test.ts index fc296efcf3..cd54cc3cee 100644 --- a/packages/jsapi-components/src/useTableSize.test.ts +++ b/packages/jsapi-components/src/useTableSize.test.ts @@ -1,7 +1,7 @@ import { act, renderHook } from '@testing-library/react-hooks'; import dh from '@deephaven/jsapi-shim'; import type { dh as DhType } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useTableSize from './useTableSize'; import useTableListener from './useTableListener'; import { makeApiContextWrapper } from './HookTestUtils'; diff --git a/packages/jsapi-components/src/useValueFilter.test.ts b/packages/jsapi-components/src/useValueFilter.test.ts index 2fd72502ae..3855c101ac 100644 --- a/packages/jsapi-components/src/useValueFilter.test.ts +++ b/packages/jsapi-components/src/useValueFilter.test.ts @@ -5,7 +5,7 @@ import { FilterConditionFactory, TableUtils, } from '@deephaven/jsapi-utils'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useValueFilter from './useValueFilter'; import useTableUtils from './useTableUtils'; diff --git a/packages/jsapi-components/src/useViewportData.test.tsx b/packages/jsapi-components/src/useViewportData.test.tsx index 7cd93cde06..ccb2ac0581 100644 --- a/packages/jsapi-components/src/useViewportData.test.tsx +++ b/packages/jsapi-components/src/useViewportData.test.tsx @@ -8,7 +8,7 @@ import { ITEM_KEY_PREFIX, } from '@deephaven/jsapi-utils'; import { useOnScrollOffsetChangeCallback } from '@deephaven/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useViewportData, { UseViewportDataProps } from './useViewportData'; import { makeApiContextWrapper } from './HookTestUtils'; import { useTableSize } from './useTableSize'; diff --git a/packages/jsapi-components/tsconfig.json b/packages/jsapi-components/tsconfig.json index 6351ddd1c0..e60b890902 100644 --- a/packages/jsapi-components/tsconfig.json +++ b/packages/jsapi-components/tsconfig.json @@ -11,6 +11,7 @@ { "path": "../jsapi-bootstrap" }, { "path": "../jsapi-shim" }, { "path": "../jsapi-utils" }, - { "path": "../log" } + { "path": "../log" }, + { "path": "../test-utils" } ] } diff --git a/packages/jsapi-utils/package.json b/packages/jsapi-utils/package.json index 594186a143..0315c5310a 100644 --- a/packages/jsapi-utils/package.json +++ b/packages/jsapi-utils/package.json @@ -29,7 +29,8 @@ "nanoid": "^5.0.7" }, "devDependencies": { - "@deephaven/jsapi-shim": "file:../jsapi-shim" + "@deephaven/jsapi-shim": "file:../jsapi-shim", + "@deephaven/test-utils": "file:../test-utils" }, "files": [ "dist" diff --git a/packages/jsapi-utils/src/FilterUtils.test.ts b/packages/jsapi-utils/src/FilterUtils.test.ts index c997a765c8..3514265287 100644 --- a/packages/jsapi-utils/src/FilterUtils.test.ts +++ b/packages/jsapi-utils/src/FilterUtils.test.ts @@ -1,7 +1,8 @@ import { Key } from 'react'; import dh from '@deephaven/jsapi-shim'; import type { dh as DhType } from '@deephaven/jsapi-types'; -import { KeyedItem, TestUtils } from '@deephaven/utils'; +import { KeyedItem } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { createComboboxFilterArgs, createFilterConditionFactory, diff --git a/packages/jsapi-utils/src/FormatterUtils.test.ts b/packages/jsapi-utils/src/FormatterUtils.test.ts index 97bb49e5ba..d0b7102e8d 100644 --- a/packages/jsapi-utils/src/FormatterUtils.test.ts +++ b/packages/jsapi-utils/src/FormatterUtils.test.ts @@ -1,5 +1,5 @@ import dh from '@deephaven/jsapi-shim'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import Formatter, { FormattingRule } from './Formatter'; import FormatterUtils, { createFormatterFromSettings, diff --git a/packages/jsapi-utils/src/MessageUtils.test.ts b/packages/jsapi-utils/src/MessageUtils.test.ts index a7a390c64e..0c28368cf2 100644 --- a/packages/jsapi-utils/src/MessageUtils.test.ts +++ b/packages/jsapi-utils/src/MessageUtils.test.ts @@ -1,4 +1,4 @@ -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { makeMessage, makeResponse, diff --git a/packages/jsapi-utils/src/TableUtils.test.ts b/packages/jsapi-utils/src/TableUtils.test.ts index ed2fb19e79..91e67f6e25 100644 --- a/packages/jsapi-utils/src/TableUtils.test.ts +++ b/packages/jsapi-utils/src/TableUtils.test.ts @@ -6,7 +6,8 @@ import { Type as FilterType, TypeValue as FilterTypeValue, } from '@deephaven/filters'; -import { getAllMethodNames, TestUtils } from '@deephaven/utils'; +import { getAllMethodNames } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import TableUtils, { DataType, SortDirection } from './TableUtils'; import DateUtils from './DateUtils'; // eslint-disable-next-line import/no-relative-packages diff --git a/packages/jsapi-utils/src/ViewportDataUtils.test.ts b/packages/jsapi-utils/src/ViewportDataUtils.test.ts index ba5f3b62e5..d2a2abfcaf 100644 --- a/packages/jsapi-utils/src/ViewportDataUtils.test.ts +++ b/packages/jsapi-utils/src/ViewportDataUtils.test.ts @@ -1,6 +1,6 @@ import { act } from '@testing-library/react-hooks'; import { dh } from '@deephaven/jsapi-types'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { ITEM_KEY_PREFIX, OnTableUpdatedEvent, diff --git a/packages/jsapi-utils/tsconfig.json b/packages/jsapi-utils/tsconfig.json index cbf29e4883..cca74d401c 100644 --- a/packages/jsapi-utils/tsconfig.json +++ b/packages/jsapi-utils/tsconfig.json @@ -10,6 +10,7 @@ { "path": "../filters" }, { "path": "../jsapi-shim" }, { "path": "../log" }, + { "path": "../test-utils" }, { "path": "../utils" } ] } diff --git a/packages/react-hooks/package.json b/packages/react-hooks/package.json index 476a98ab00..3bd4852949 100644 --- a/packages/react-hooks/package.json +++ b/packages/react-hooks/package.json @@ -28,6 +28,9 @@ "lodash.throttle": "^4.1.1", "nanoid": "^5.0.7" }, + "devDependencies": { + "@deephaven/test-utils": "file:../test-utils" + }, "peerDependencies": { "react": ">=16.8.0" }, diff --git a/packages/react-hooks/src/ElementUtils.ts b/packages/react-hooks/src/ElementUtils.ts index ed5cfe4a2f..52bf4e1274 100644 --- a/packages/react-hooks/src/ElementUtils.ts +++ b/packages/react-hooks/src/ElementUtils.ts @@ -1,10 +1,20 @@ import { + Component, + FunctionComponent, isValidElement, JSXElementConstructor, ReactElement, ReactNode, } from 'react'; -import { InferComponentProps } from '@deephaven/utils'; + +/** + * Extracts the props type from a React component type. + */ +export type InferComponentProps = T extends FunctionComponent + ? P + : T extends Component + ? P + : never; /** * Check if a node is a React element of a specific type. diff --git a/packages/react-hooks/src/SpectrumUtils.test.ts b/packages/react-hooks/src/SpectrumUtils.test.ts index 9fb99afe31..ef2e9353d4 100644 --- a/packages/react-hooks/src/SpectrumUtils.test.ts +++ b/packages/react-hooks/src/SpectrumUtils.test.ts @@ -1,4 +1,5 @@ -import { KeyedItem, TestUtils } from '@deephaven/utils'; +import { KeyedItem } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import type { DOMRefValue } from '@react-types/shared'; import { createValidationProps, diff --git a/packages/react-hooks/src/useAsyncInterval.test.ts b/packages/react-hooks/src/useAsyncInterval.test.ts index 6d7ebf6179..67581e04af 100644 --- a/packages/react-hooks/src/useAsyncInterval.test.ts +++ b/packages/react-hooks/src/useAsyncInterval.test.ts @@ -1,6 +1,6 @@ import { renderHook, act } from '@testing-library/react-hooks'; import Log from '@deephaven/log'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useAsyncInterval from './useAsyncInterval'; jest.mock('@deephaven/log', () => { diff --git a/packages/react-hooks/src/useCheckOverflow.test.ts b/packages/react-hooks/src/useCheckOverflow.test.ts index 9499e91889..c1c8b351a4 100644 --- a/packages/react-hooks/src/useCheckOverflow.test.ts +++ b/packages/react-hooks/src/useCheckOverflow.test.ts @@ -1,6 +1,6 @@ import { act, renderHook } from '@testing-library/react-hooks'; import type { DOMRefValue } from '@react-types/shared'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useCheckOverflow } from './useCheckOverflow'; const { createMockProxy } = TestUtils; diff --git a/packages/react-hooks/src/useContentRect.test.ts b/packages/react-hooks/src/useContentRect.test.ts index 42e248b822..a3d9091e4a 100644 --- a/packages/react-hooks/src/useContentRect.test.ts +++ b/packages/react-hooks/src/useContentRect.test.ts @@ -1,5 +1,5 @@ import { act, renderHook } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useContentRect } from './useContentRect'; import useResizeObserver from './useResizeObserver'; diff --git a/packages/react-hooks/src/useFormWithDetachedSubmitButton.test.ts b/packages/react-hooks/src/useFormWithDetachedSubmitButton.test.ts index 9f241401c6..5b386cc735 100644 --- a/packages/react-hooks/src/useFormWithDetachedSubmitButton.test.ts +++ b/packages/react-hooks/src/useFormWithDetachedSubmitButton.test.ts @@ -1,5 +1,5 @@ import { nanoid } from 'nanoid'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { renderHook } from '@testing-library/react-hooks'; import type { FocusableRefValue } from '@react-types/shared'; import useFormWithDetachedSubmitButton from './useFormWithDetachedSubmitButton'; diff --git a/packages/react-hooks/src/useMappedRef.test.ts b/packages/react-hooks/src/useMappedRef.test.ts index f45a1ce860..c8eb954c69 100644 --- a/packages/react-hooks/src/useMappedRef.test.ts +++ b/packages/react-hooks/src/useMappedRef.test.ts @@ -1,6 +1,6 @@ import { MutableRefObject } from 'react'; import { renderHook } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useMappedRef from './useMappedRef'; const { asMock } = TestUtils; diff --git a/packages/react-hooks/src/useMappedSelection.test.ts b/packages/react-hooks/src/useMappedSelection.test.ts index 67c32d7b91..bbb8a9eb22 100644 --- a/packages/react-hooks/src/useMappedSelection.test.ts +++ b/packages/react-hooks/src/useMappedSelection.test.ts @@ -1,6 +1,7 @@ import { Key } from 'react'; import { renderHook } from '@testing-library/react-hooks'; -import { KeyedItem, TestUtils } from '@deephaven/utils'; +import { KeyedItem } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import { useMappedSelection } from './useMappedSelection'; import { WindowedListData } from './useWindowedListData'; import { mapSelection, optimizeSelection } from './SelectionUtils'; diff --git a/packages/react-hooks/src/useOnScrollOffsetChangeCallback.test.ts b/packages/react-hooks/src/useOnScrollOffsetChangeCallback.test.ts index 39c4565c54..90855b0bc6 100644 --- a/packages/react-hooks/src/useOnScrollOffsetChangeCallback.test.ts +++ b/packages/react-hooks/src/useOnScrollOffsetChangeCallback.test.ts @@ -1,5 +1,5 @@ import { renderHook } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useOnScrollOffsetChangeCallback from './useOnScrollOffsetChangeCallback'; const { createMockProxy } = TestUtils; diff --git a/packages/react-hooks/src/usePopoverOnScrollRef.test.tsx b/packages/react-hooks/src/usePopoverOnScrollRef.test.tsx index 7bdb1d33ca..b99332f582 100644 --- a/packages/react-hooks/src/usePopoverOnScrollRef.test.tsx +++ b/packages/react-hooks/src/usePopoverOnScrollRef.test.tsx @@ -1,7 +1,7 @@ import React from 'react'; import { render } from '@testing-library/react'; import { act, renderHook } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import usePopoverOnScrollRef from './usePopoverOnScrollRef'; const { asMock, createMockProxy } = TestUtils; diff --git a/packages/react-hooks/src/useSetAttributesCallback.test.ts b/packages/react-hooks/src/useSetAttributesCallback.test.ts index 6499f00ef9..baf1f8a847 100644 --- a/packages/react-hooks/src/useSetAttributesCallback.test.ts +++ b/packages/react-hooks/src/useSetAttributesCallback.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import { HTMLAttributes } from 'react'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useSetAttributesCallback from './useSetAttributesCallback'; beforeEach(() => { diff --git a/packages/react-hooks/src/useSpectrumDisableSpellcheckRef.test.ts b/packages/react-hooks/src/useSpectrumDisableSpellcheckRef.test.ts index 5b4ee8f2dc..20a20c3d25 100644 --- a/packages/react-hooks/src/useSpectrumDisableSpellcheckRef.test.ts +++ b/packages/react-hooks/src/useSpectrumDisableSpellcheckRef.test.ts @@ -1,6 +1,6 @@ import { renderHook } from '@testing-library/react-hooks'; import { DOMRefValue } from '@react-types/shared'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useSetAttributesCallback from './useSetAttributesCallback'; import { SPELLCHECK_FALSE_ATTRIBUTE, diff --git a/packages/react-hooks/src/useWindowedListData.test.ts b/packages/react-hooks/src/useWindowedListData.test.ts index e4e711f61d..4ce8767452 100644 --- a/packages/react-hooks/src/useWindowedListData.test.ts +++ b/packages/react-hooks/src/useWindowedListData.test.ts @@ -4,7 +4,7 @@ import { renderHook, RenderHookResult, } from '@testing-library/react-hooks'; -import { TestUtils } from '@deephaven/utils'; +import { TestUtils } from '@deephaven/test-utils'; import useWindowedListData, { defaultGetKey, WindowedListData, diff --git a/packages/react-hooks/tsconfig.json b/packages/react-hooks/tsconfig.json index 80c334df0c..132d9cce0e 100644 --- a/packages/react-hooks/tsconfig.json +++ b/packages/react-hooks/tsconfig.json @@ -6,5 +6,9 @@ }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"], "exclude": ["node_modules", "src/**/*.test.*", "src/**/__mocks__/*"], - "references": [{ "path": "../log" }, { "path": "../utils" }] + "references": [ + { "path": "../log" }, + { "path": "../test-utils" }, + { "path": "../utils" } + ] } diff --git a/packages/test-utils/README.md b/packages/test-utils/README.md new file mode 100644 index 0000000000..ab999695d0 --- /dev/null +++ b/packages/test-utils/README.md @@ -0,0 +1,9 @@ +# @deephaven/test-utils + +A library with some test utility functions used by Deephaven. It is recommended to install as a `dev` dependency. + +## Install + +```bash +npm install --save-dev @deephaven/test-utils +``` diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json new file mode 100644 index 0000000000..d1dbb92a88 --- /dev/null +++ b/packages/test-utils/package.json @@ -0,0 +1,31 @@ +{ + "name": "@deephaven/test-utils", + "version": "0.93.0", + "description": "Deephaven Test Utils", + "author": "Deephaven Data Labs LLC", + "license": "Apache-2.0", + "type": "module", + "repository": { + "type": "git", + "url": "https://github.com/deephaven/web-client-ui.git", + "directory": "packages/utils" + }, + "source": "src/index.js", + "main": "dist/index.js", + "module": "dist/index.js", + "types": "dist/index.d.ts", + "engines": { + "node": ">=16" + }, + "scripts": { + "build": "cross-env NODE_ENV=production run-p build:*", + "build:babel": "babel ./src --out-dir ./dist --extensions \".ts,.tsx,.js,.jsx\" --source-maps --root-mode upward" + }, + "files": [ + "dist" + ], + "sideEffects": false, + "publishConfig": { + "access": "public" + } +} diff --git a/packages/utils/src/MockProxy.test.ts b/packages/test-utils/src/MockProxy.test.ts similarity index 100% rename from packages/utils/src/MockProxy.test.ts rename to packages/test-utils/src/MockProxy.test.ts diff --git a/packages/utils/src/MockProxy.ts b/packages/test-utils/src/MockProxy.ts similarity index 100% rename from packages/utils/src/MockProxy.ts rename to packages/test-utils/src/MockProxy.ts diff --git a/packages/utils/src/TestUtils.test.tsx b/packages/test-utils/src/TestUtils.test.tsx similarity index 100% rename from packages/utils/src/TestUtils.test.tsx rename to packages/test-utils/src/TestUtils.test.tsx diff --git a/packages/utils/src/TestUtils.ts b/packages/test-utils/src/TestUtils.ts similarity index 99% rename from packages/utils/src/TestUtils.ts rename to packages/test-utils/src/TestUtils.ts index d121c470ce..710cde65e7 100644 --- a/packages/utils/src/TestUtils.ts +++ b/packages/test-utils/src/TestUtils.ts @@ -43,7 +43,7 @@ export type PickMethods = { export type ConsoleMethodName = keyof PickMethods; -class TestUtils { +export class TestUtils { /** * jest.useFakeTimers mocks `process.nextTick` by default. Hold on to a * reference to the real function so we can still use it. diff --git a/packages/test-utils/src/TypeUtils.ts b/packages/test-utils/src/TypeUtils.ts new file mode 100644 index 0000000000..ace32629c4 --- /dev/null +++ b/packages/test-utils/src/TypeUtils.ts @@ -0,0 +1,28 @@ +/** + * Tuple type. + * @param T Type of the items in the tuple + * @param N Length of the tuple + */ +export type Tuple = N extends 0 + ? [] + : N extends 1 + ? [T] + : N extends 2 + ? [T, T] + : N extends 3 + ? [T, T, T] + : N extends 4 + ? [T, T, T, T] + : N extends 5 + ? [T, T, T, T, T] + : N extends 6 + ? [T, T, T, T, T, T] + : N extends 7 + ? [T, T, T, T, T, T, T] + : N extends 8 + ? [T, T, T, T, T, T, T, T] + : N extends 9 + ? [T, T, T, T, T, T, T, T, T] + : N extends 10 + ? [T, T, T, T, T, T, T, T, T, T] + : Array; diff --git a/packages/test-utils/src/index.ts b/packages/test-utils/src/index.ts new file mode 100644 index 0000000000..4d058248c6 --- /dev/null +++ b/packages/test-utils/src/index.ts @@ -0,0 +1 @@ +export * from './TestUtils'; diff --git a/packages/test-utils/src/jest.config.cjs b/packages/test-utils/src/jest.config.cjs new file mode 100644 index 0000000000..365815a412 --- /dev/null +++ b/packages/test-utils/src/jest.config.cjs @@ -0,0 +1,7 @@ +const baseConfig = require('../../jest.config.base.cjs'); +const packageJson = require('./package'); + +module.exports = { + ...baseConfig, + displayName: packageJson.name, +}; diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json new file mode 100644 index 0000000000..8c183dff36 --- /dev/null +++ b/packages/test-utils/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "rootDir": "src/", + "outDir": "dist/" + }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"], + "exclude": ["node_modules", "src/**/*.test.*", "src/**/__mocks__/*"] +} diff --git a/packages/utils/package.json b/packages/utils/package.json index d902865efc..a894827260 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -27,5 +27,8 @@ "sideEffects": false, "publishConfig": { "access": "public" + }, + "devDependencies": { + "@deephaven/test-utils": "file:../test-utils" } } diff --git a/packages/utils/src/ColorUtils.test.ts b/packages/utils/src/ColorUtils.test.ts index 4242dfb937..89ca25bd08 100644 --- a/packages/utils/src/ColorUtils.test.ts +++ b/packages/utils/src/ColorUtils.test.ts @@ -1,5 +1,5 @@ +import { TestUtils } from '@deephaven/test-utils'; import ColorUtils from './ColorUtils'; -import TestUtils from './TestUtils'; const { createMockProxy } = TestUtils; diff --git a/packages/utils/src/DOMUtils.test.ts b/packages/utils/src/DOMUtils.test.ts index acdd53cbb7..7eced15ddd 100644 --- a/packages/utils/src/DOMUtils.test.ts +++ b/packages/utils/src/DOMUtils.test.ts @@ -1,9 +1,9 @@ +import { TestUtils } from '@deephaven/test-utils'; import { getClosestByClassName, identityExtractHTMLElement, syncAnimationStartTime, } from './DOMUtils'; -import TestUtils from './TestUtils'; const { createMockProxy } = TestUtils; diff --git a/packages/utils/src/TypeUtils.ts b/packages/utils/src/TypeUtils.ts index f3a921fa6a..c77dd2e2a0 100644 --- a/packages/utils/src/TypeUtils.ts +++ b/packages/utils/src/TypeUtils.ts @@ -1,5 +1,3 @@ -import type { Component, FunctionComponent } from 'react'; - /** * Util type to create a "subtype" of T. Useful for creating subsets of union * types. @@ -15,15 +13,6 @@ import type { Component, FunctionComponent } from 'react'; */ export type Extends = U extends T ? U : never; -/** - * Extracts the props type from a React component type. - */ -export type InferComponentProps = T extends FunctionComponent - ? P - : T extends Component - ? P - : never; - /** * Derives a union type where all constituents define 1 property of the original * type. @@ -38,35 +27,6 @@ export type OnlyOneProp = { [P in keyof T]: { [ONEPROP in P]: T[ONEPROP] }; }[keyof T]; -/** - * Tuple type. - * @param T Type of the items in the tuple - * @param N Length of the tuple - */ -export type Tuple = N extends 0 - ? [] - : N extends 1 - ? [T] - : N extends 2 - ? [T, T] - : N extends 3 - ? [T, T, T] - : N extends 4 - ? [T, T, T, T] - : N extends 5 - ? [T, T, T, T, T] - : N extends 6 - ? [T, T, T, T, T, T] - : N extends 7 - ? [T, T, T, T, T, T, T] - : N extends 8 - ? [T, T, T, T, T, T, T, T] - : N extends 9 - ? [T, T, T, T, T, T, T, T, T] - : N extends 10 - ? [T, T, T, T, T, T, T, T, T, T] - : Array; - /** * Remove `Partial` wrapper from a type. Note that this is slightly different * than `Required` because it will preserve optional properties on the original diff --git a/packages/utils/src/index.ts b/packages/utils/src/index.ts index dc0afb0ada..c4ed91f522 100644 --- a/packages/utils/src/index.ts +++ b/packages/utils/src/index.ts @@ -24,6 +24,4 @@ export { default as TimeUtils } from './TimeUtils'; export * from './TypeUtils'; export { default as InvalidMetadataError } from './InvalidMetadataError'; export { default as ValidationError } from './ValidationError'; -export { default as TestUtils } from './TestUtils'; -export * from './TestUtils'; export * from './UIConstants'; diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index 8c183dff36..7917a8934d 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -5,5 +5,6 @@ "outDir": "dist/" }, "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"], - "exclude": ["node_modules", "src/**/*.test.*", "src/**/__mocks__/*"] + "exclude": ["node_modules", "src/**/*.test.*", "src/**/__mocks__/*"], + "references": [{ "path": "../test-utils" }] }