Skip to content

Commit

Permalink
refactor: Split out @deephaven/test-utils package (#2225)
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
bmingles authored Sep 17, 2024
1 parent bc720d1 commit 1d027d3
Show file tree
Hide file tree
Showing 118 changed files with 265 additions and 128 deletions.
2 changes: 1 addition & 1 deletion jest.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
38 changes: 36 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
1 change: 1 addition & 0 deletions packages/app-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/app-utils/src/components/AppBootstrap.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/app-utils/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
{ "path": "../plugin" },
{ "path": "../react-hooks" },
{ "path": "../redux" },
{ "path": "../test-utils" },
{ "path": "../utils" }
]
}
1 change: 1 addition & 0 deletions packages/auth-plugins/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
"js-cookie": "^3.0.5"
},
"devDependencies": {
"@deephaven/test-utils": "file:../test-utils",
"@types/react": "^17.0.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/AuthPluginBase.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/auth-plugins/src/AuthPluginParent.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
1 change: 1 addition & 0 deletions packages/auth-plugins/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
{ "path": "../jsapi-utils" },
{ "path": "../log" },
{ "path": "../redux" },
{ "path": "../test-utils" },
{ "path": "../utils" }
]
}
1 change: 1 addition & 0 deletions packages/chart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/src/ChartModelFactory.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/chart/src/ChartTheme.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="./declaration" />

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';
Expand Down
1 change: 1 addition & 0 deletions packages/chart/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{ "path": "../jsapi-utils" },
{ "path": "../log" },
{ "path": "../react-hooks" },
{ "path": "../test-utils" },
{ "path": "../utils" }
]
}
1 change: 1 addition & 0 deletions packages/code-studio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/code-studio/src/main/AppMainContainer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion packages/code-studio/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
{ "path": "../redux" },
{ "path": "../storage" },
{ "path": "../utils" },
{ "path": "../filters" }
{ "path": "../filters" },
{ "path": "../test-utils" }
]
}
1 change: 1 addition & 0 deletions packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
},
"devDependencies": {
"@deephaven/mocks": "file:../mocks",
"@deephaven/test-utils": "file:../test-utils",
"react-redux": "^7.2.4"
},
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/ErrorBoundary.test.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/ItemList.test.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/theme/ThemeProvider.test.tsx
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/theme/ThemeUtils.test.ts
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/theme/useTheme.test.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/components/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"references": [
{ "path": "../log" },
{ "path": "../react-hooks" },
{ "path": "../test-utils" },
{ "path": "../utils" }
]
}
3 changes: 2 additions & 1 deletion packages/console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion packages/console/src/ConsoleStatusBar.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit 1d027d3

Please sign in to comment.