我正在尝试为现有的React应用程序设置测试。经过一番努力,我们正在使用React 16.8.13,我已经让它工作了。为此,我不得不安装jest 24.9.0和babel-jest 24.9.0。测试运行得很好,我得到了一份覆盖率报告。然而,当我运行yarn start时,我得到了一个错误:
The react-scripts package provided by Create React App requires a dependency:
"babel-jest": "23.6.0"
Don't try to install it manu
10:52:56 PM: There might be a problem with the project dependency tree.
10:52:56 PM: It is likely not a bug in Create React App, but something you need to fix locally.
10:52:56 PM: The react-scripts package provided by Create React App requires a dependency:
10:52:56 PM: "babel-jest":
我是jest新手,想测试一下我的react.js应用程序。我正在阅读一本书,“jest部分的React.js要点”。
以下是我的测试代码Button-test.js
jest.dontMock('../Button.react');
describe('Button component', function () {
it('calls handler function on click', function () {
var React = require('react');
var TestUtils =
我正在使用ubantu 16操作系统,我已经安装了
节点版本v10.13.0和npm版本6.4.1
我正在创建基于的Reactjs项目。
我使用命令创建了项目
sudo npm init react-app my-app
此命令成功地创建了我的-app,但是当我使用npm 命令在我的-app文件夹下运行项目时,我将得到以下错误:
> my-app@0.1.0 start /home/karan/workspace/1425/my-app
> react-scripts start
There might be a problem with the project dep
我所做的就是运行创建-反应-应用程序和光盘进入应用程序,然后尝试运行npm/yarn start。我得到以下错误/输出/日志。我已经走过了所有建议的步骤。唯一起作用的是SKIP_PREFLIGHT_CHECK=true在我的.env,作为雅恩和npm的最后手段。我最近更新到Mojave,如果人们有类似的体验,我不得不重新安装我的Xcode。
Last login: Tue Oct 30 16:30:24 on ttys002
TheLAB11:~ jasonspiller$ cd repos/react-express-graphql-app/
TheLAB11:react-express-g
在将CRA更新到第5版之后。
在运行npm test时,我看到以下错误:
Determining test suites to run...
● Test suite failed to run
TypeError: babelJest.createTransformer is not a function
at Object.<anonymous> (node_modules/react-app-rewired/scripts/utils/babelTransform.js:16:28)
at node_modules/@jest/tra
当我试图在我的package.json中更新笑话时,我试图解决我遇到的问题
jest 26.6.3→27.0.1
I接收错误
TypeError: require(...).createTransformer is not a function
at Object.<anonymous> (/local/repo/elukchm/monorepo/packages/edf/jestPreprocess.js:34:40)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._ext
我向一段反应性代码添加了一个快照测试,并在以下错误中发生了这个错误:Unexpected node type: SequenceExpression (This is an error on an internal node. Probably an internal error. Location has been estimated.)
代码转换并工作得很好,没有警告我任何事情。
在这个新的测试之前,没有其他测试给我任何类似的错误,我们的代码库中有相当多的错误。
我尝试重新安装jest,重新安装babel-jest,删除和重新安装所有模块(使用yarn --pure-lock),将jest
我正在尝试将一个项目从使用karma、phantomJs迁移到jest,但我无法正确获取配置文件。我一直收到以下错误:
FAIL test/unit/components/SomethingWentWrong/SomethingWentWrong.spec.js
● Test suite failed to run
Cannot find module 'npm:react@16.4.1/index.js' from 'react@16.4.1.js'
> 1 | module.exports = require("np