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. top命令详解-性能分析

    top命令是Linux下常用的性能分析工具,能够实时显示系统中各个进程的资源占用状况,常用于服务端性能分析. top命令说明 [www.linuxidc.com@linuxidc-t-tomcat-1 ...

  2. 新编日语1234册/重排本/全册 pdf

    网上找的资源链接大部分都失效了,无奈之下只好淘宝购买.顺便分享一下吧. 链接: https://pan.baidu.com/s/1v5-osHKrIPzlgpd8yNIP5Q 提取码: kexn

  3. Monkey patching

    "A monkey patch is a way to extend or modify the run-time code of dynamic languages without alt ...

  4. Zookeeper语法

    ZooKeeper 是一个典型的分布式数据一致性解决方案,分布式应用程序可以基于 ZooKeeper 实现诸如数据发布/订阅.负载均衡.命名服务.分布式协调/通知.集群管理.Master 选举.分布式 ...

  5. vue3系列:vue3.0自定义虚拟滚动条V3Scroll|vue3模拟滚动条组件

    基于Vue3.0构建PC桌面端自定义美化滚动条组件V3Scroll. 前段时间有分享一个Vue3 PC网页端弹窗组件,今天带来最新开发的Vue3.0版虚拟滚动条组件. V3Scroll 使用vue3. ...

  6. Java——入门“HelloWorld”

    //Java程序的结构 //下面这个:外层框架 public class HellloWorld { // Java入口程序框架 //类名与文件名完全一样 public static void mai ...

  7. java8 新特性---列表

  8. JavaWeb——JSP,JSP指令,注释

    什么是JSP JSP原理 JSP页面中的java代码服务器是如何执行的 Web服务器在调用jsp时会给jsp提供一些什么java对象 JSP执行过程 JSP页面的元素包括 JSP模版元素 JSP脚本片 ...

  9. C语言--指针数组大小

    #include <stdio.h> #include <string.h> int main(void) { char *str[3]={ "Hello,thisi ...

  10. Java初体验

    参考书籍「Java语言程序设计基础篇」 比特与字节 计算机中只有0和1,二进制,即比特(bit,二进制数): 字节(byte)是最小的存储单元,每个字节有8个比特组成 即:1byte=8bit 各种数 ...