reactjs - 为什么调试器要求我再次弹出?

标签 reactjs google-chrome-devtools jestjs create-react-app

我正在研究 create-react-app,并尝试了弹出选项。在“yarn eject”之后,我正在尝试通过终端进行调试:

> react-scripts --inspect-brk test --runInBand

Debugger listening on ws://127.0.0.1:9229/45316de1-972e-47ab-9ce8-7ce2f183a378
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

当点击 chrome://inspect/#devices 中的检查链接时,控制台打开并显示:

Out of the box, Create React App only supports overriding these Jest options: • collectCoverageFrom • coverageReporters • coverageThreshold • globalSetup • globalTeardown • resetMocks • resetModules • snapshotSerializers • watchPathIgnorePatterns.These options in your package.json Jest configuration are not currently supported by Create React App: • resolver • setupFiles • testMatch • testEnvironment • testURL • transform • transformIgnorePatterns • moduleNameMapper • moduleFileExtensionsIf you wish to override other Jest options, you need to eject from the default setup. You can do so by running npm run eject but remember that this is a one-way operation. You may also file an issue with Create React App to discuss supporting more options out of the box.

这很奇怪,因为我以为我已经运行了弹出?

最佳答案

react-scripts 是未弹出的 create-react-app 运行的可执行文件,因此无论项目是否被弹出,它都会产生此消息。

npm run eject 将弹出的项目 scripts 中的 react-scripts 替换为实际命令。在弹出的项目中,预计 npm run test 会直接执行 jest 而不是 react-scripts test

如果目的是为 Node 提供额外的参数,它可能是这样的:

node --inspect-brk node_modules/.bin/jest test --runInBand

关于reactjs - 为什么调试器要求我再次弹出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52792305/

相关文章:

reactjs - 还原/ react 。实现后 combineReducers 无法获取应用程序的状态

javascript - Reactjs 中的 changedropdown 更新数据被延迟

android - 自定义字体在 React Native 中不起作用

javascript - 无法在 Chrome 中编辑样式?

reactjs - npm错误: 'specify configs in the ini-formatted file:' \User\. npmrc

使用 selenium 获取 Chrome Devtools 内容的 Python 脚本

javascript - 使用工作空间时在 chrome 开发工具中美化代码

reactjs - 如何使用 FormData 发送 event.target 以模拟函数

javascript - 如何使用 Jest/Supertest/Knex/Postgres 处理外键约束

react-native - 测试 Pressable 的按下状态