如何跳过使用jest从'react'中导入React的测试文件

211 阅读1分钟

我正在使用反应的测试库。

我在我的测试文件中这样做了

import React from 'react' // best if I can skip this in every test file
import { render, screen } from '@testing-library/react'

但我得到了这个错误

`@testing-library/react` import should occur before import of `react`

要么我关闭eslint规则的顺序,要么我可以在每个测试文件中跳过导入React的步骤。