相关疑难解决方法(0)

如何在 create-react-app 中使用 jest.config.js

我想将我的 jest 配置移出我的 package.json,我正在尝试按照此处的建议使用 --config,但出现错误argv.config.match is not a function

包.json

  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test --config jest.config.js",
    "eject": "react-scripts eject",
  },
Run Code Online (Sandbox Code Playgroud)

命令行

hutber@hutber-mac:/var/www/management/node$ npm test -u

> management-fresh@0.1.0 test /var/www/management/node
> react-scripts test --config jest.config.js

Usage: test.js [--config=<pathToConfigFile>] [TestPathPattern]


argv.config.match is not a function
npm ERR! Test failed.  See above for more details.
Run Code Online (Sandbox Code Playgroud)

javascript testing reactjs jestjs create-react-app

21
推荐指数
4
解决办法
2万
查看次数

标签 统计

create-react-app ×1

javascript ×1

jestjs ×1

reactjs ×1

testing ×1