如何将jest.config.js与create-action-app一起使用

我想将jest配置从包中移出。json,我正在尝试使用建议的--confighere,但收到错误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

相关文章