初学者在这里。如问题所述...我正在尝试将 puppeteer 预设与 Jest 一起使用,但我在下面收到此错误。有人有想法么?我已经发布了我的 package.json 文件。
错误: ################################################ ####################################### package.json Jest 配置中的这些选项是Create React App 目前不支持:
• 预设
如果您希望覆盖其他 Jest 选项,则需要从默认设置中退出。您可以通过运行 npm runeject 来做到这一点,但请记住这是一种单向操作。你也可以向 Create React App 提出问题,讨论支持更多开箱即用的选项。
{
"name": "getting_started",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.6",
"@testing-library/user-event": "^12.8.3",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-scripts": "4.0.3",
"react-test-renderer": "^17.0.2",
"web-vitals": "^1.1.1"
},
"jest": {
"preset": "jest-puppeteer"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"devDependencies": {
"babel-eslint": "^10.1.0",
"eslint": "^7.26.0",
"eslint-plugin-react": "^7.23.2",
"jest": "^26.6.0",
"jest-puppeteer": "^5.0.3",
"prop-types": "^15.7.2",
"puppeteer": "^9.1.1"
},
"keywords": [],
"author": "",
"license": "ISC"
}