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

package.json

  "scripts": { 
    "start": "react-scripts start", 
    "build": "react-scripts build", 
    "test": "react-scripts test --config jest.config.js", 
    "eject": "react-scripts eject", 
  }, 

cli

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. 

请您参考如下方法:

对我来说,附加 -- --config=jest.config.js 有效。

所以整个字符串 react-scripts test -- --config jest.config.js 在你的情况下。


评论关闭
IT虾米网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!