如何将jest.config.js与create-action-app一起使用 [英] How to use jest.config.js with create-react-app

查看:33
本文介绍了如何将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

这篇关于如何将jest.config.js与create-action-app一起使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆