jest ignore

modulePathIgnorePatterns

https://jestjs.io/docs/en/configuration


modulePathIgnorePatterns [array]

https://jestjs.io/docs/en/configuration#modulepathignorepatterns-arraystring

// Default
[] // Example
["<rootDir>/build/"]

testPathIgnorePatterns [array]

https://jestjs.io/docs/en/configuration#testpathignorepatterns-arraystring


// Default
["/node_modules/"] // Example
["<rootDir>/build/", "<rootDir>/node_modules/"].

coveragePathIgnorePatterns [array]

https://jestjs.io/docs/en/configuration#coveragepathignorepatterns-arraystring

// Default
["/node_modules/"] // Example
["<rootDir>/build/", "<rootDir>/node_modules/"].

watchPathIgnorePatterns [array]

https://jestjs.io/docs/en/configuration#watchpathignorepatterns-arraystring

// Example
["<rootDir>/node_modules/"].

transformIgnorePatterns [array]

https://jestjs.io/docs/en/configuration#transformignorepatterns-arraystring

// Default
["/node_modules/", "\\.pnp\\.[^\\\/]+$"] // Example
["<rootDir>/bower_components/", "<rootDir>/node_modules/"].

https://jestjs.io/docs/en/tutorial-react-native#transformignorepatterns-customization

demos

modulePathIgnorePatterns: ["directoryNameToIgnore"]
# OR
modulePathIgnorePatterns: ["<rootDir>/dist/"]

jest.config.js


// jest.config.js
const {defaults} = require('jest-config'); module.exports = {
// ...
moduleFileExtensions: [
...defaults.moduleFileExtensions,
'js',
'mjs',
// 'jsx',
// 'ts',
// 'tsx',
],
// ...
// preset: [],
modulePathIgnorePatterns: [
"<rootDir>/dist/",
"<rootDir>/000-xyz/",
"<rootDir>/jest/",
"<rootDir>/node.js-week-one/",
"<rootDir>/practices/",
],
watchPathIgnorePatterns: [
"<rootDir>/dist/",
"<rootDir>/000-xyz/",
"<rootDir>/jest/",
"<rootDir>/node.js-week-one/",
"<rootDir>/practices/",
],
testPathIgnorePatterns: [
"<rootDir>/build/",
"<rootDir>/node_modules/",
],
coveragePathIgnorePatterns: [
"<rootDir>/build/",
"<rootDir>/node_modules/",
],
};

exclude/ignore file(s) from coverage

{
"jest": {
"collectCoverageFrom": [
"src/**/{!(ignore-me),}.js"
]
}
}
/* istanbul ignore file */


/* istanbul ignore next */
function myFunc() {
console.log(
"Not covered but won't appear on coverage reports as such"
);
}

refs

https://www.cnblogs.com/xgqfrms/tag/jest/

https://stackoverflow.com/questions/40486567/how-to-exclude-files-from-jest-watch

https://codewithhugo.com/jest-exclude-coverage/

https://codewithhugo.com/run-skip-single-jest-test/

https://github.com/facebook/jest/issues/1815



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


jest ignore的更多相关文章

  1. 基于Typescript和Jest刷题环境搭建与使用

    写在前面 前几个月在公司用vue3和ts写项目,想巩固一下基础,于是我想起了去年基于JavaScript和Jest搭建的刷题环境,不如,给它搞个加强版,结合Typescript和Jest 搞一个刷题环 ...

  2. AutoMapper:Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type

    异常处理汇总-后端系列 http://www.cnblogs.com/dunitian/p/4523006.html 应用场景:ViewModel==>Mode映射的时候出错 AutoMappe ...

  3. cin.ignore()函数的用法

    cin.ignore(a,ch)方法是从输入流(cin)中提取字符,提取的字符被忽略(ignore),不被使用.每抛弃一个字符,它都要计数和比较字符:如果计数值达到a或者被抛弃的字符是ch,则cin. ...

  4. iOS8: Ignore manifest download, already have bundleID

    在企业分发的app下载过程中,iOS8发现挂在官网上的企业版的app点击了提示是否安装应用程序,但始终安装不上程序,的device console发现安装的时候出现 LoadExternalDownl ...

  5. svn ignore

    工程名为simple,采用maven进行依赖管理,在check in时我不想工程下maven产生的target目录被提交到SVN(包括目录下所有文件和目录本身). 解决方法: 要被忽略的目录必须是未版 ...

  6. git ignore

    我最初将整个项目push到远程仓库,但是项目代码里面有大文件,从而传输太费时间了. 看网上的说法,可以通过ignore文件达到不提交某些文件的效果,尝试了一下发现不行. 后来尝试清除缓存 $ git ...

  7. MySQL中的insert ignore into, replace into等的一些用法总结

    在MySQL中进行条件插入数据时,可能会用到以下语句,现小结一下.我们先建一个简单的表来作为测试: CREATE TABLE `books` ( `id` INT(11) NOT NULL AUTO_ ...

  8. 解决git .ignore文件无效

    在用 Git 进行代码管理的时候,我们会用 .gitignore 文件来描述哪些文件是不需要进行版本管理的,也就是被忽略掉. 如果我们在第一次提交的时候,忘记添加 .gitignore 文件或者在首次 ...

  9. Force StyleCop to Ignore a File

    You can quickly force StyleCop to ignore files in a project by manually modifying the project file, ...

随机推荐

  1. 解决Spirng注入时名称下的红色波浪线

    解决Spirng注入时名称下的红色波浪线 报错情形: 解决办法: 方案一: 如果可以正常运行,那么可能是类没有交给Spring管理,如下图,我们只需要在对应的接口(或者类上)加上@Component注 ...

  2. 客户端必须在它发送到服务器的所有帧中添加掩码(Mask)

    在WebSocket协议中,数据是通过一系列数据帧来进行传输的.为了避免由于网络中介(例如一些拦截代理)或者一些在第10.3节讨论的安全原因,客户端必须在它发送到服务器的所有帧中添加掩码(Mask)( ...

  3. (010)每日SQL学习:按字母顺序排列字符串

    需求:一串字母'ADFGH',需要按照顺序来显示:A D F G H 第一步:先把字符串拆分 with test as( select 'ADFGH' as a from dual ) select ...

  4. pip freeze 需求文件requirements.txt的创建及使用 虚拟环境

    总结: 1.输出安装的包信息,并在另一个环境快速安装 Generate output suitable for a requirements file. $ pip freeze docutils== ...

  5. 腾讯libco协程原理

    https://blog.csdn.net/GreyBtfly/article/details/83688420 堆栈 https://blog.csdn.net/lqt641/article/det ...

  6. HDU1814和平委员会

    题目大意: 有n对的人,编号从1-2*n,m对的人之间互相不喜欢,每对人中必徐选1个人加入和平委员会,求字典序最小的解 -------------------------------- 2-SAT问题 ...

  7. Java中Socket的用法

    Socket分为ServerSocket和Socket两大类: 其中ServerSocket用于服务器端,可以通过accept方法监听请求,监听到请求后返回Socket: Socket用户具体完成数据 ...

  8. java 去掉重复的数字

    public static void main(String[] args) { String s="1,2,2,2,2,2,3,3,3"; String[] array = s. ...

  9. 33.vsftpd服务程序--本地用户模式

    1.针对本地用户模式的权限参数以及作用如下 [root@localhost ~]# vim /etc/vsftpd/vsftpd.conf 1 anonymous_enable=NO 2 local_ ...

  10. 弱网测试之Fidder

    是用Fidder可以模拟若罔测试. 1.Fiider设置 fiddler中选中Rules->Cutomize Rules,在文件中搜索关键字:m_SimulateModem: 修改m_Simul ...