我的 jest.config.js 中有以下内容
module.exports = {
preset: 'ts-jest/presets/js-with-ts',
testEnvironment: 'jsdom'
};
但当我运行 npm test 时它被忽略。有人可以帮忙吗?
这是我的 package.json
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
似乎要添加-- --config=jest.config.js
足够。
您可以尝试将 package.json 中的脚本“test”替换为react-scripts test -- --config=jest.config.js
,否则你可以直接将 jest 配置设置到 package.json 中
您可以在这里找到答案:如何将 jest.config.js 与 create-react-app 一起使用 https://stackoverflow.com/questions/59878153/how-to-use-jest-config-js-with-create-react-app
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)