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. Spring AOP介绍与使用

    Spring AOP介绍与使用 AOP:Aspect Oriented Programming 面向切面编程 OOP:Object Oriented Programming 面向对象编程 ​ 面向切面 ...

  2. XV6学习(8)中断和设备驱动

    驱动是操作系统中用于管理特定设备的代码:驱动控制设备硬件,通知硬件执行操作,处理中断,与等待该设备IO的进程进行交互. 当设备需要与操作系统进行交互时,就会产生中断(陷阱的一种),之后内核的陷阱处理代 ...

  3. Smarty 3.1.34 反序列化POP链(任意文件删除)

    Smarty <= 3.1.34,存在任意文件删除的POP链. Exp: <?php class Smarty_Internal_Template { public $smarty = n ...

  4. SpringMVC听课笔记(十一:国际化)

    1. 关于国际化 -- 在页面上根据浏览器的语言设置情况对文本(不是内容),时间,数值进行本地化处理 使用JSTL的fmt标签 -- 可以在bean中获取国际化资源文件 Locale对应的消息 在be ...

  5. Java基础图解,JVM,线程,Spring,TCP,SpringMVC等开发体系图解

    Java基础图解,JVM,线程,Spring,TCP,SpringMVC等开发体系图解 1.Java虚拟机运行时数据区图 2. 堆的默认分配图 3.方法区结构图 4.对象的内存布局图 5.对象头的Ma ...

  6. php小程序-文章发布系统

    php小程序-文章发布系统 一 项目相关视图 二 项目经验 主要用于熟悉php与mysql的相关操作 三 源码下载地址 http://files.cnblogs.com/files/qiujun/ar ...

  7. LA 3641 Leonardo的笔记本 & UVA 11077 排列统计

    LA 3641 Leonardo的笔记本 题目 给出26个大写字母的置换B,问是否存在要给置换A,使得 \(A^2 = B\) 分析 将A分解为几个循环,可以观察经过乘积运算得到\(A^2\)后,循环 ...

  8. 【uva 534】Frogger(图论--最小瓶颈路 模版题)

    题意:平面上有N个石头,给出坐标.一只青蛙从1号石头跳到2号石头,使路径上的最长便最短.输出这个值.(2≤N≤200) 解法:最小瓶颈树.而由于这题N比较小便可以用2种方法:1.最短路径中提到过的Fl ...

  9. Codeforces Round #633 (Div. 2)

    Codeforces Round #633(Div.2) \(A.Filling\ Diamonds\) 答案就是构成的六边形数量+1 //#pragma GCC optimize("O3& ...

  10. Educational Codeforces Round 89 (Rated for Div. 2) C Palindromic Paths

    题目链接:Palindromic Paths 题意: 给你一个n行m列的矩阵,这个矩阵被0或者1所填充,你需要从点(1,1)走到点(n,m).这个时候会有很多路径,每一条路径对应一个01串,你可以改变 ...