Skip to content

Commit

Permalink
deps: Update nx to 19.0.1
Browse files Browse the repository at this point in the history
- Resolve issues arround broken type resolution in test files inside
  webap-core package
- Remove redunant React imports in test files
- Use correct testing library package for renderHook - remove conosle
  warnings
- Refresh nx pnpm patch to match new version
  • Loading branch information
emil-litwiniec committed May 10, 2024
1 parent 2becfe7 commit 81c8b88
Show file tree
Hide file tree
Showing 25 changed files with 2,555 additions and 1,190 deletions.
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
"@babel/preset-react": "^7.24.1",
"@graphql-codegen/cli": "^5.0.0",
"@graphql-typed-document-node/core": "^3.2.0",
"@nx/devkit": "18.3.4",
"@nx/eslint": "18.3.4",
"@nx/eslint-plugin": "18.3.4",
"@nx/jest": "18.3.4",
"@nx/js": "18.3.4",
"@nx/node": "18.3.4",
"@nx/plugin": "18.3.4",
"@nx/react": "18.3.4",
"@nx/web": "18.3.4",
"@nx/webpack": "18.3.4",
"@nx/devkit": "19.0.1",
"@nx/eslint": "19.0.1",
"@nx/eslint-plugin": "19.0.1",
"@nx/jest": "19.0.1",
"@nx/js": "19.0.1",
"@nx/node": "19.0.1",
"@nx/plugin": "19.0.1",
"@nx/react": "19.0.1",
"@nx/web": "19.0.1",
"@nx/webpack": "19.0.1",
"@sb/cli": "workspace:*",
"@sb/core": "workspace:*",
"@storybook/addon-actions": "^8.0.9",
Expand All @@ -31,16 +31,16 @@
"@tailwindcss/typography": "^0.5.10",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "14.0.0",
"@testing-library/react": "15.0.6",
"@testing-library/react-hooks": "^8.0.1",
"@testing-library/user-event": "^14.5.1",
"@trivago/prettier-plugin-sort-imports": "^4.3.0",
"@types/gtag.js": "^0.0.14",
"@types/jest": "^29.5.10",
"@types/node": "18.19.32",
"@types/ramda": "^0.28.25",
"@types/react": "^18.2.24",
"@types/react-dom": "^18.2.9",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/react-router": "^5.1.20",
"@types/react-router-dom": "5.3.3",
"@types/react-test-renderer": "^18.0.7",
Expand Down Expand Up @@ -69,7 +69,7 @@
"jest-matcher-utils": "^29.7.0",
"jest-watch-typeahead": "^2.2.2",
"lint-staged": "^14.0.1",
"nx": "18.3.4",
"nx": "19.0.1",
"nx-cloud": "18.0.1",
"plop": "^4.0.0",
"prettier": "^3.1.0",
Expand Down Expand Up @@ -102,8 +102,8 @@
"@sentry/react": "^7.84.0",
"@supercharge/strings": "^2.0.0",
"ramda": "^0.28.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-helmet-async": "^1.3.0",
"react-hook-form": "^7.48.2",
"react-intl": "^6.5.5",
Expand All @@ -116,7 +116,7 @@
},
"pnpm": {
"patchedDependencies": {
"nx@18.3.4": "patches/nx@18.3.4.patch"
"nx@19.0.1": "patches/nx@19.0.1.patch"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';

import { Alert, AlertDescription, AlertTitle } from '../';
import { render } from '../../../tests/utils/rendering';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { render , screen } from '@testing-library/react';
import { render, screen } from '@testing-library/react';

import React from 'react';
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '../';



describe('Cards: Component', () => {
const content = 'content';
const header = 'header';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { fireEvent, screen } from '@testing-library/react';
import React from 'react';

import { Dialog, DialogContent, DialogHeader } from '../';
import { render } from '../../../tests/utils/rendering';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React, { ReactNode } from 'react';
import { ReactNode } from 'react';

import { render } from '../../../../tests/utils/rendering';
import { Checkbox } from '../checkbox.component';
Expand All @@ -19,15 +19,15 @@ describe('Checkbox: Component', () => {

it('should be unchecked by default', async () => {
render(<Component />);
expect(((await screen.findByRole('checkbox', { hidden: true })) as HTMLButtonElement).dataset.state).toEqual(
expect(((await screen.findByRole('checkbox', { hidden: true })) as HTMLButtonElement).dataset['state']).toEqual(
'unchecked'
);
});

it('should be checked after clicking', async () => {
render(<Component />);
await userEvent.click(await screen.findByText('Checkbox label'));
expect((screen.getByRole('checkbox', { hidden: true }) as HTMLButtonElement).dataset.state).toEqual('checked');
expect((screen.getByRole('checkbox', { hidden: true }) as HTMLButtonElement).dataset['state']).toEqual('checked');
});

it('should render provided error message', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';
import { useForm } from 'react-hook-form';

import { Form, FormField, FormItem, FormLabel, FormMessage } from '../';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';

import { PageHeadline, PageHeadlineProps } from '../';
import { render } from '../../../tests/utils/rendering';
Expand All @@ -14,7 +13,7 @@ describe('PageHeadline', () => {
it('Should render page headline with header', async () => {
render(<Component data-testid="testid" className="h-12" />);

expect(await screen.getByTestId('testid').className).toContain('h-12');
expect(screen.getByTestId('testid').className).toContain('h-12');
expect(screen.getByText(header)).toBeInTheDocument();
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';

import { PageLayout } from '../';
import { render } from '../../../tests/utils/rendering';
Expand All @@ -8,6 +7,6 @@ describe('PageLayout', () => {
it('Should render page layout', async () => {
render(<PageLayout data-testid="testid" className="h-12" />);

expect(await screen.getByTestId('testid').className).toContain('flex-1 space-y-8 px-8 lg:max-w-3xl');
expect(screen.getByTestId('testid').className).toContain('flex-1 space-y-8 px-8 lg:max-w-3xl');
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';

import { render } from '../../../tests/utils/rendering';
import { Pagination, PaginationProps } from '../pagination.component';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as PopoverPrimitive from '@radix-ui/react-popover';
import { screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';

import { Popover, PopoverContent, PopoverTrigger } from '../';
import { render } from '../../../tests/utils/rendering';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';

import { render } from '../../../tests/utils/rendering';
import { Separator } from '../separator.component';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { screen } from '@testing-library/react';
import React from 'react';
import { render } from '../../../tests/utils/rendering';

import { Skeleton } from '../';
import { render } from '../../../tests/utils/rendering';

describe('Skeleton', () => {
it('Should render rounded skeleton', async () => {
render(<Skeleton data-testid="testid" className="h-12 w-12 rounded-full" />);

expect(await screen.getByTestId('testid').className).toContain('h-12 w-12 rounded-full');
expect(screen.getByTestId('testid').className).toContain('h-12 w-12 rounded-full');
});
});
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { screen } from '@testing-library/react';
import React from 'react';

import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from '../';
import { render } from '../../../tests/utils/rendering';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as TabsPrimitive from '@radix-ui/react-tabs/dist';
import { screen } from '@testing-library/react';
import { userEvent } from '@testing-library/user-event';
import React from 'react';

import { Tabs, TabsContent, TabsList, TabsTrigger } from '../';
import { render } from '../../../tests/utils/rendering';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';

import { useLocales } from '../';
import { Locale } from '../../../config/i18n';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';

import { useMappedConnection } from '../useMappedConnection.hook';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';

import { ResponsiveThemeProvider } from '../../../providers';
import { media } from '../../../theme';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { act, renderHook } from '@testing-library/react-hooks';
import { act, renderHook } from '@testing-library/react';

import { useOpenState } from '../useOpenState.hook';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';

import { useTheme } from '../';
import { ThemeContext, Themes } from '../../../providers/themeProvider';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { empty } from 'ramda';
import throttle from 'lodash.throttle';
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
import { useWindowListener } from '../useWindowListener.hook';
import { UnknownObject } from '../../../utils/types';

Expand Down
6 changes: 4 additions & 2 deletions packages/webapp-libs/webapp-core/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,12 @@
"noImplicitOverride": true,
"noPropertyAccessFromIndexSignature": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
"types": ["@testing-library/jest-dom"],
"noFallthroughCasesInSwitch": true,
"jsx": "react-jsx"
},
"files": [],
"include": [],
"include": ["./src/**/**.*"],
"references": [
{
"path": "./tsconfig.lib.json"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
import { {{ camelCase name }} } from '../{{ camelCase name }}.hook';

describe('{{ camelCase name }}: Hook', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { renderHook } from '@testing-library/react-hooks';
import { renderHook } from '@testing-library/react';
import { useLocation } from 'react-router-dom';

import { useRouterScrollToTop } from '../';
Expand Down
6 changes: 3 additions & 3 deletions patches/[email protected] → patches/[email protected]
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
diff --git a/src/tasks-runner/run-command.js b/src/tasks-runner/run-command.js
index cd830d3c34639a5d8a52c12b3975e8c309ba8f9b..8300356271db5e2a815d3b51443a5f6682858181 100644
index 68db405163db9a779d85f376ec2e6af6f08ce084..8c91bd498dc03b20e0c1d56301ce89a1af957756 100644
--- a/src/tasks-runner/run-command.js
+++ b/src/tasks-runner/run-command.js
@@ -114,7 +114,7 @@ function setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles) {
@@ -112,7 +112,7 @@ function setEnvVarsBasedOnArgs(nxArgs, loadDotEnvFiles) {
if (nxArgs.outputStyle == 'stream-without-prefixes') {
process.env.NX_STREAM_OUTPUT = 'true';
}
- if (loadDotEnvFiles) {
+ if (loadDotEnvFiles && !process.env.NX_LOAD_DOT_ENV_FILES) {
process.env.NX_LOAD_DOT_ENV_FILES = 'true';
}
}
}
Loading

0 comments on commit 81c8b88

Please sign in to comment.