Unverified Commit dfaf137b authored by Janka Uryga's avatar Janka Uryga Committed by GitHub

test: remove "@testing-library/jest-dom" from default jest setup (#78157)

We aren't using `'@testing-library/jest-dom'` in 99% of the tests, so
there's no point loading it for every test. I've removed it from
`jest-setup-after-env` and added the import manually to each file that
uses it.
parent f7375659
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { render, screen } from '@testing-library/react' import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import Link from 'next/link' import Link from 'next/link'
test('single child', () => { test('single child', () => {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
import React from 'react' import React from 'react'
import { render } from '@testing-library/react' import { render } from '@testing-library/react'
import '@testing-library/jest-dom'
import Hello from '../components/hello' import Hello from '../components/hello'
......
// @ts-ignore
import * as matchers from 'jest-extended' import * as matchers from 'jest-extended'
import '@testing-library/jest-dom'
expect.extend(matchers) expect.extend(matchers)
// A default max-timeout of 90 seconds is allowed // A default max-timeout of 90 seconds is allowed
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { render, screen } from '@testing-library/react' import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import Component from './client-component' import Component from './client-component'
it('works with client-only code', () => { it('works with client-only code', () => {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { fireEvent, render, screen } from '@testing-library/react' import { fireEvent, render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import Component from './component' import Component from './component'
it('works with client-only code', () => { it('works with client-only code', () => {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { render, screen } from '@testing-library/react' import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import Page from './page' import Page from './page'
it('works with server-only imported code', () => { it('works with server-only imported code', () => {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { render, screen } from '@testing-library/react' import { render, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import Page from './page' import Page from './page'
it('works with client-only code', () => { it('works with client-only code', () => {
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
* @jest-environment jsdom * @jest-environment jsdom
*/ */
import { act, render } from '@testing-library/react' import { act, render } from '@testing-library/react'
import '@testing-library/jest-dom'
import Link from 'next/link' import Link from 'next/link'
import React from 'react' import React from 'react'
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
*/ */
import React from 'react' import React from 'react'
import { act, render } from '@testing-library/react' import { act, render } from '@testing-library/react'
import '@testing-library/jest-dom'
import dynamic from 'next/dynamic' import dynamic from 'next/dynamic'
describe('next/dynamic', () => { describe('next/dynamic', () => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment