关于 SyntaxError: Cannot use import statement outside a module
来源:19-4 -写QuestionTitle和QuestionParagraph的单元测试-通过style断言isCenter

Neolu4ever
2023-08-13
我发现当我在 Component.tsx 中通过以下方式引入 Title 等组件时,单元测试就回报如题的错误
import Title from “antd/es/typography/Paragraph”;
因此只能更换为课程中,从 Typography 中获取的方式才可以顺利通过测试:
const { Title } = Typography;
我的疑问是为什么文件中有其他 import 的语法,但是 jest 只是锁定了这个来报错呢?
写回答
1回答
-
双越
2023-08-13
没太看懂你的描述。关键部分的代码,给我截图吧。
00
相似问题