Skip to content

Commit

Permalink
⬆️ jest-dom v6.x (#3138)
Browse files Browse the repository at this point in the history
* update to jest-dom 6.1.4

* remove @types/testing-library__jest-dom

* add jest/globals to .eslintrc

* fix test setup

* fix broken tests

* remove superfluous jest-dom/jest-styled imports

* global import jest-styled-components

* update slider snapshot

* utils: update tsconfig

* lab: update tsconfig

* data-grid update tsconfig

* tsconfig: try using types field instead

* try fix problem with utils

* add @types/jest

* update tsconfigs again
  • Loading branch information
oddvernes authored Nov 3, 2023
1 parent 75dd50b commit 088bd68
Show file tree
Hide file tree
Showing 65 changed files with 403 additions and 270 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"@babel/preset-react": "^7.22.15",
"@babel/preset-typescript": "^7.23.2",
"@babel/runtime": "^7.23.2",
"@types/jest": "^29.5.7",
"@types/jest-axe": "^3.5.7",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/eds-core-react/jest.setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable import/no-extraneous-dependencies */
import '@testing-library/jest-dom/extend-expect'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { toHaveNoViolations } from 'jest-axe'

expect.extend(toHaveNoViolations)
Expand Down
3 changes: 1 addition & 2 deletions packages/eds-core-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,13 @@
"@storybook/react": "^7.5.1",
"@storybook/react-vite": "^7.5.1",
"@testing-library/dom": "^9.3.3",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/jest-dom": "^6.1.4",
"@testing-library/react": "14.0.0",
"@testing-library/user-event": "14.5.1",
"@types/jest": "^29.5.6",
"@types/ramda": "^0.29.7",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"@types/testing-library__jest-dom": "^5.14.6",
"babel-loader": "^9.1.3",
"babel-plugin-styled-components": "^2.1.4",
"jest": "^29.7.0",
Expand Down
75 changes: 37 additions & 38 deletions packages/eds-core-react/pnpm-lock.yaml

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

Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable react/require-default-props */
import { render, screen, fireEvent } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import { attach_file, notifications } from '@equinor/eds-icons'
import { Accordion } from '.'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ import {
within,
waitFor,
} from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'

import styled from 'styled-components'
import { Autocomplete } from '.'

Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Avatar/Avatar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Avatar } from '.'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Banner/Banner.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { add } from '@equinor/eds-icons'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef, ElementType, useMemo } from 'react'
import styled, { css } from 'styled-components'
import { OverridableComponent } from '@equinor/eds-utils'
import type { OverridableComponent } from '@equinor/eds-utils'
import { Typography } from '../Typography'
import { Tooltip } from '../Tooltip'
import { breadcrumbs as tokens } from './Breadcrumbs.tokens'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, fireEvent, act, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Breadcrumbs } from '.'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Button/Button.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen, fireEvent } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { save } from '@equinor/eds-icons'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Card/Card.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Typography } from '../Typography'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* eslint-disable no-undef */

import { useState } from 'react'
import { render, fireEvent, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import userEvent from '@testing-library/user-event'
import styled from 'styled-components'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Chip/Chip.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { render, fireEvent, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import 'jest-styled-components'
import styled from 'styled-components'
import { add } from '@equinor/eds-icons'
import { Chip } from './Chip'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Dialog/Dialog.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable no-undef */
import { useState } from 'react'
import { render, screen, fireEvent } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { dialog as tokens } from './Dialog.tokens'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import 'jest-styled-components'
import styled from 'styled-components'
import * as tokens from './Divider.tokens'
import { Divider } from '.'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Icon/Icon.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { save } from '@equinor/eds-icons'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Input/Input.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import 'jest-styled-components'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Input } from './Input'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Label } from './Label'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/List/List.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { List } from '.'
Expand Down
3 changes: 0 additions & 3 deletions packages/eds-core-react/src/components/Menu/Menu.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
/* eslint-disable no-undef */
import { render, cleanup, screen, fireEvent, act, waitFor } from '../../test'
import '@testing-library/jest-dom'
import '@testing-library/jest-dom/extend-expect'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Menu } from '.'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen, within } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { Pagination } from '.'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable no-undef */
import { render, cleanup, screen, waitFor, act } from '../../test'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import 'jest-styled-components'
import styled from 'styled-components'
import { Popover } from '.'
import type { PopoverProps } from './Popover'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import 'jest-styled-components'
import styled from 'styled-components'
import { CircularProgress } from './CircularProgress'
import * as tokens from './CircularProgress.tokens'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import * as tokens from './DotProgress.tokens'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import 'jest-styled-components'
import styled from 'styled-components'
import { LinearProgress } from './LinearProgress'

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/* eslint-disable no-undef */
import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { StarProgress } from './StarProgress'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Radio/Radio.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-disable no-undef */
import { render, fireEvent, screen } from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import '@testing-library/jest-dom'
import { axe } from 'jest-axe'
import 'jest-styled-components'
import styled from 'styled-components'

import { Radio } from './Radio'
Expand Down
2 changes: 0 additions & 2 deletions packages/eds-core-react/src/components/Scrim/Scrim.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
/* eslint-disable no-undef */
import { useState } from 'react'
import { render, screen, fireEvent } from '@testing-library/react'
import '@testing-library/jest-dom'
import 'jest-styled-components'
import { axe } from 'jest-axe'
import styled from 'styled-components'
import { scrim as tokens } from './Scrim.tokens'
Expand Down
Loading

0 comments on commit 088bd68

Please sign in to comment.