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. MDX学习笔记(整理) MDX语法

    1.1.members和Children的用法. select [Measures].[Internet Sales Count] on columns, [客户].[全名] on rows from ...

  2. 支付回调地址 同步回调地址 异步回调地址 return_url和notify_url的区别

    [微信支付]JSAPI支付开发者文档 https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_16&index=10 退款结果通知 ...

  3. 理解前端模块概念:CommonJs与ES6Module

    前言 现代前端开发每时每刻都和模块打交道.例如,在项目中引入一个插件,或者实现一个供全局使用组件的JS文件.这些都可以称为模块. 在设计程序结构时,不可能把所有代码都放在一起.更为友好的组织方式时按照 ...

  4. SparkSQL访问Hive源,MySQL源

    SparkSQL访问Hive源,MySQL源 一.SparkSQL访问Hive源 软件环境 SparkSQL命令行模式可以直接连接Hive的 Java程序SparkSQL连接Hive 二.SparkS ...

  5. Java获取类路径的方式

    Java环境中,如何获取当前类的路径.如何获取项目根路径等: @Test public void showURL() throws IOException { // 第一种:获取类加载的根路径 Fil ...

  6. Ajax(form表单文件上传、请求头之contentType、Ajax传递json数据、Ajax文件上传)

    form表单文件上传 上菜 file_put.html <form action="" method="post" enctype="multi ...

  7. 2.centos 7清空文件和文件夹

    1.清空文件 测试文件:a.txt 1)方法一,[root@centos test]# > a.txt [root@centos test]# cat a.txt 1hjbfao hjkl23o ...

  8. 人均年薪50万以上,docker到底是什么?为什么这么火?

    为什么要使用Docker? 场景一:公司双十一买了一堆服务器,技术总监让你给它们一个个都配置上JDK.Mysql.Redis等软件环境. 你心里小声嘀咕:"这总监不讲武德!"然后你 ...

  9. xLua热更新插件

    一.xLua插件下载安装 1.从GitHub上搜索并下载插件 2.将文件复制到unity中 3.检查是否有错误 二.在unity中调用lua 1.简单调用 在c#脚本中使用LuaEnv类可以运行lua ...

  10. Educational Codeforces Round 21

    Educational Codeforces Round 21  A. Lucky Year 个位数直接输出\(1\) 否则,假设\(n\)十进制最高位的值为\(s\),答案就是\(s-(n\mod ...