mirror of
https://github.com/WeBankFinTech/fes.js.git
synced 2025-04-06 03:59:53 +08:00
323 lines
58 KiB
HTML
323 lines
58 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="zh-CN">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||
<meta name="generator" content="VuePress 2.0.0-beta.28">
|
||
<link rel="manifest" href="/manifest.webmanifest"><link rel="icon" href="/logo.png"><title>@fesjs/plugin-jest | Fes.js</title><meta name="description" content="一个好用的前端应用解决方案">
|
||
<link rel="preload" href="/fes.js/assets/js/runtime~app.e7cf0416.js" as="script"><link rel="preload" href="/fes.js/assets/css/styles.3651737f.css" as="style"><link rel="preload" href="/fes.js/assets/js/519.22262c34.js" as="script"><link rel="preload" href="/fes.js/assets/js/app.704a6fe6.js" as="script">
|
||
<link rel="stylesheet" href="/fes.js/assets/css/styles.3651737f.css">
|
||
</head>
|
||
<body>
|
||
<div id="app"><!--[--><div class="theme-container"><!--[--><header class="navbar"><div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0"><div class="icon" aria-hidden="true"><span></span><span></span><span></span></div></div><span><a href="/fes.js/" class=""><!----><span class="site-name can-hide">Fes.js</span></a></span><div class="navbar-links-wrapper" style=""><!--[--><!--]--><nav class="navbar-links can-hide"><!--[--><div class="navbar-links-item"><a href="/fes.js/guide/" class="nav-link" aria-label="指南"><!--[--><!--]--> 指南 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/config/" class="nav-link" aria-label="配置"><!--[--><!--]--> 配置 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/api/" class="nav-link" aria-label="API"><!--[--><!--]--> API <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/plugin/" class="nav-link router-link-active" aria-label="插件"><!--[--><!--]--> 插件 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/cli/" class="nav-link" aria-label="CLI"><!--[--><!--]--> CLI <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="版本"><span class="title">版本</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="版本"><span class="title">版本</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://fesjs.mumblefe.cn/next" rel="noopener noreferrer" target="_blank" aria-label="next(3.0)"><!--[--><!--]--> next(3.0) <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://fesjs.mumblefe.cn/1.0" rel="noopener noreferrer" target="_blank" aria-label="1.0"><!--[--><!--]--> 1.0 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://github.com/WeBankFinTech/fes.js/blob/master/CHANGELOG.md" rel="noopener noreferrer" target="_blank" aria-label="更新日志"><!--[--><!--]--> 更新日志 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="http://fes-design.mumblefe.cn/" rel="noopener noreferrer" target="_blank" aria-label="fes-design"><!--[--><!--]--> fes-design <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/WeBankFinTech/fes.js" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><button class="toggle-dark-button" title="toggle dark mode"><svg style="" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z" fill="currentColor"></path><path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path><path d="M2 15.005h5v2H2z" fill="currentColor"></path><path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 25.005h2v5h-2z" fill="currentColor"></path><path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path><path d="M25 15.005h5v2h-5z" fill="currentColor"></path><path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path><path d="M15 2.005h2v5h-2z" fill="currentColor"></path></svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32"><path d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z" fill="currentColor"></path></svg></button><!----></div></header><!--]--><div class="sidebar-mask"></div><!--[--><aside class="sidebar"><nav class="navbar-links"><!--[--><div class="navbar-links-item"><a href="/fes.js/guide/" class="nav-link" aria-label="指南"><!--[--><!--]--> 指南 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/config/" class="nav-link" aria-label="配置"><!--[--><!--]--> 配置 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/api/" class="nav-link" aria-label="API"><!--[--><!--]--> API <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/plugin/" class="nav-link router-link-active" aria-label="插件"><!--[--><!--]--> 插件 <!--[--><!--]--></a></div><div class="navbar-links-item"><a href="/fes.js/reference/cli/" class="nav-link" aria-label="CLI"><!--[--><!--]--> CLI <!--[--><!--]--></a></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="版本"><span class="title">版本</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="版本"><span class="title">版本</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://fesjs.mumblefe.cn/next" rel="noopener noreferrer" target="_blank" aria-label="next(3.0)"><!--[--><!--]--> next(3.0) <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="https://fesjs.mumblefe.cn/1.0" rel="noopener noreferrer" target="_blank" aria-label="1.0"><!--[--><!--]--> 1.0 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><div class="dropdown-wrapper"><button class="dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="arrow down"></span></button><button class="mobile-dropdown-title" type="button" aria-label="了解更多"><span class="title">了解更多</span><span class="right arrow"></span></button><!--[--><ul style="display:none;" class="nav-dropdown"><!--[--><li class="dropdown-item"><a class="nav-link external" href="https://github.com/WeBankFinTech/fes.js/blob/master/CHANGELOG.md" rel="noopener noreferrer" target="_blank" aria-label="更新日志"><!--[--><!--]--> 更新日志 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><li class="dropdown-item"><a class="nav-link external" href="http://fes-design.mumblefe.cn/" rel="noopener noreferrer" target="_blank" aria-label="fes-design"><!--[--><!--]--> fes-design <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></li><!--]--></ul><!--]--></div></div><div class="navbar-links-item"><a class="nav-link external" href="https://github.com/WeBankFinTech/fes.js" rel="noopener noreferrer" target="_blank" aria-label="GitHub"><!--[--><!--]--> GitHub <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></div><!--]--></nav><!--[--><!--]--><ul class="sidebar-links"><!--[--><!--[--><a href="/fes.js/reference/plugin/" class="nav-link router-link-active sidebar-heading sidebar-item" aria-label="介绍"><!--[--><!--]--> 介绍 <!--[--><!--]--></a><!----><!--]--><!--[--><p class="sidebar-heading sidebar-item active">Plugins</p><ul class=""><li><!--[--><a href="/fes.js/reference/plugin/plugins/access.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-access"><!--[--><!--]--> @fesjs/plugin-access <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/enums.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-enums"><!--[--><!--]--> @fesjs/plugin-enums <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/icon.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-icon"><!--[--><!--]--> @fesjs/plugin-icon <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html" class="router-link-active router-link-exact-active nav-link router-link-active sidebar-item active" aria-label="@fesjs/plugin-jest"><!--[--><!--]--> @fesjs/plugin-jest <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#启用方式" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="启用方式"><!--[--><!--]--> 启用方式 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#约定" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="约定"><!--[--><!--]--> 约定 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#命令" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="命令"><!--[--><!--]--> 命令 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#配置" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="配置"><!--[--><!--]--> 配置 <!--[--><!--]--></a><ul class="sidebar-sub-items"><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#args-变量" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="args 变量"><!--[--><!--]--> args 变量 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#配置文件" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="配置文件"><!--[--><!--]--> 配置文件 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a aria-current="page" href="/fes.js/reference/plugin/plugins/jest.html#优先级" class="router-link-active router-link-exact-active nav-link sidebar-item" aria-label="优先级"><!--[--><!--]--> 优先级 <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--></li></ul><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/layout.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-layout"><!--[--><!--]--> @fesjs/plugin-layout <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/locale.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-locale"><!--[--><!--]--> @fesjs/plugin-locale <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/model.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-model"><!--[--><!--]--> @fesjs/plugin-model <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/request.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-request"><!--[--><!--]--> @fesjs/plugin-request <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/vuex.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-vuex"><!--[--><!--]--> @fesjs/plugin-vuex <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/qiankun.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-qiankun"><!--[--><!--]--> @fesjs/plugin-qiankun <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/windicss.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-windicss"><!--[--><!--]--> @fesjs/plugin-windicss <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/sass.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-sass"><!--[--><!--]--> @fesjs/plugin-sass <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/editor.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-monaco-editor"><!--[--><!--]--> @fesjs/plugin-monaco-editor <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/pinia.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-pinia"><!--[--><!--]--> @fesjs/plugin-pinia <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/plugins/watermark.html" class="nav-link sidebar-item" aria-label="@fesjs/plugin-watermark"><!--[--><!--]--> @fesjs/plugin-watermark <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--[--><p class="sidebar-heading sidebar-item">插件开发</p><ul class=""><li><!--[--><a href="/fes.js/reference/plugin/dev/" class="nav-link sidebar-item" aria-label="插件介绍"><!--[--><!--]--> 插件介绍 <!--[--><!--]--></a><!----><!--]--></li><li><!--[--><a href="/fes.js/reference/plugin/dev/api.html" class="nav-link sidebar-item" aria-label="插件 API"><!--[--><!--]--> 插件 API <!--[--><!--]--></a><!----><!--]--></li></ul><!--]--><!--]--></ul><!--[--><!--]--></aside><!--]--><!--[--><main class="page"><!--[--><!--]--><div class="theme-default-content"><!--[--><h1 id="fesjs-plugin-jest" tabindex="-1"><a class="header-anchor" href="#fesjs-plugin-jest" aria-hidden="true">#</a> @fesjs/plugin-jest</h1><p>集成 <a href="https://www.jestjs.cn/" target="_blank" rel="noopener noreferrer">Jest<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span></a> 测试框架,目前只支持单元测试和覆盖测试。</p><h2 id="启用方式" tabindex="-1"><a class="header-anchor" href="#启用方式" aria-hidden="true">#</a> 启用方式</h2><p>在 <code>package.json</code> 中引入依赖:</p><div class="language-json ext-json line-numbers-mode"><pre class="language-json"><code><span class="token punctuation">{</span>
|
||
<span class="token property">"dependencies"</span><span class="token operator">:</span> <span class="token punctuation">{</span>
|
||
<span class="token property">"@fesjs/fes"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span><span class="token punctuation">,</span>
|
||
<span class="token property">"@fesjs/plugin-jest"</span><span class="token operator">:</span> <span class="token string">"^2.0.0"</span>
|
||
<span class="token punctuation">}</span><span class="token punctuation">,</span>
|
||
<span class="token punctuation">}</span>
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br></div></div><h2 id="约定" tabindex="-1"><a class="header-anchor" href="#约定" aria-hidden="true">#</a> 约定</h2><ul><li>项目根目录下 <code>tests</code> 和 <code>__tests__</code> 文件夹中的 <code>js</code> 或者 <code>jsx</code> 文件为测试文件。</li><li>需要覆盖测试的文件范围是<code>src/index.{js,jsx,ts,tsx,vue}</code></li></ul><p>例如测试文件 <code>add.js</code>:</p><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>fes-template
|
||
├── __tests__
|
||
│ └── add.js
|
||
└── src
|
||
├── .fes
|
||
└── utils
|
||
└── sum.js
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br></div></div><p>内容如下:</p><div class="language-javascript ext-js line-numbers-mode"><pre class="language-javascript"><code><span class="token keyword">import</span> sum <span class="token keyword">from</span> <span class="token string">'@/utils/sum'</span><span class="token punctuation">;</span>
|
||
<span class="token function">test</span><span class="token punctuation">(</span><span class="token string">'adds 1 + 2 to equal 3'</span><span class="token punctuation">,</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=></span> <span class="token punctuation">{</span>
|
||
<span class="token function">expect</span><span class="token punctuation">(</span><span class="token function">sum</span><span class="token punctuation">(</span><span class="token number">1</span><span class="token punctuation">,</span> <span class="token number">2</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">.</span><span class="token function">toBe</span><span class="token punctuation">(</span><span class="token number">3</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
|
||
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br></div></div><h2 id="命令" tabindex="-1"><a class="header-anchor" href="#命令" aria-hidden="true">#</a> 命令</h2><p>在 <code>fes</code> 上注册 <code>test</code> 命令:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ fes <span class="token builtin class-name">test</span>
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><h2 id="配置" tabindex="-1"><a class="header-anchor" href="#配置" aria-hidden="true">#</a> 配置</h2><p>插件实现 Jest 的全部配置,具体请查看 <a href="https://www.jestjs.cn/docs/configuration#reference" target="_blank" rel="noopener noreferrer">文档-configuration<span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span></a>。 也可以使用 <code>-h</code> 打印配置帮助信息:</p><h3 id="args-变量" tabindex="-1"><a class="header-anchor" href="#args-变量" aria-hidden="true">#</a> args 变量</h3><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ fes <span class="token builtin class-name">test</span> -h
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><p>打印配置帮助信息:</p><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>$ fes test -h
|
||
Usage: fes test [options]
|
||
|
||
run unit tests with jest
|
||
|
||
Options:
|
||
--all The opposite of `onlyChanged`. If `onlyChanged`
|
||
is set by default, running jest with `--all`
|
||
will force Jest to run all tests instead of
|
||
running only tests related to changed files.
|
||
--automock Automock all files by default.
|
||
-b --bail Exit the test suite immediately after `n`
|
||
number of failing tests.
|
||
--browser Respect the "browser" field in package.json
|
||
when resolving modules. Some packages export
|
||
different versions based on whether they are
|
||
operating in node.js or a browser.
|
||
--cache Whether to use the transform cache. Disable the
|
||
cache using --no-cache.
|
||
--cacheDirectory The directory where Jest should store its
|
||
cached dependency information.
|
||
--changedFilesWithAncestor Runs tests related to the current changes and
|
||
the changes made in the last commit. Behaves
|
||
similarly to `--onlyChanged`.
|
||
--changedSince Runs tests related to the changes since the
|
||
provided branch. If the current branch has
|
||
diverged from the given branch, then only
|
||
changes made locally will be tested. Behaves
|
||
similarly to `--onlyChanged`.
|
||
--ci Whether to run Jest in continuous integration
|
||
(CI) mode. This option is on by default in most
|
||
popular CI environments. It will prevent
|
||
snapshots from being written unless explicitly
|
||
requested.
|
||
--clearCache Clears the configured Jest cache directory and
|
||
then exits. Default directory can be found by
|
||
calling jest --showConfig
|
||
--clearMocks Automatically clear mock calls and instances
|
||
between every test. Equivalent to calling
|
||
jest.clearAllMocks() between each test.
|
||
--collectCoverage Alias for --coverage.
|
||
--collectCoverageFrom A glob pattern relative to <rootDir> matching
|
||
the files that coverage info needs to be
|
||
collected from.
|
||
--collectCoverageOnlyFrom Explicit list of paths coverage will be
|
||
restricted to.
|
||
--color Forces test results output color highlighting
|
||
(even if stdout is not a TTY). Set to false if
|
||
you would like to have no colors.
|
||
--colors Alias for `--color`.
|
||
-c --config The path to a jest config file specifying how
|
||
to find and execute tests. If no rootDir is set
|
||
in the config, the directory containing the
|
||
config file is assumed to be the rootDir for
|
||
the project.This can also be a JSON encoded
|
||
value which Jest will use as configuration.
|
||
--coverage Indicates that test coverage information should
|
||
be collected and reported in the output.
|
||
--coverageDirectory The directory where Jest should output its
|
||
coverage files.
|
||
--coveragePathIgnorePatterns An array of regexp pattern strings that are
|
||
matched against all file paths before executing
|
||
the test. If the file pathmatches any of the
|
||
patterns, coverage information will be skipped.
|
||
--coverageProvider Select between Babel and V8 to collect coverage
|
||
--coverageReporters A list of reporter names that Jest uses when
|
||
writing coverage reports. Any istanbul reporter
|
||
can be used.
|
||
--coverageThreshold A JSON string with which will be used to
|
||
configure minimum threshold enforcement for
|
||
coverage results
|
||
--debug Print debugging info about your jest config.
|
||
--detectLeaks **EXPERIMENTAL**: Detect memory leaks in tests.
|
||
After executing a test, it will try to garbage
|
||
collect the global object used, and fail if it
|
||
was leaked
|
||
--detectOpenHandles Print out remaining open handles preventing
|
||
Jest from exiting at the end of a test run.
|
||
Implies `runInBand`.
|
||
--env The test environment used for all tests. This
|
||
can point to any file or node module. Examples:
|
||
`jsdom`, `node` or `path/to/my-environment.js`
|
||
--errorOnDeprecated Make calling deprecated APIs throw helpful
|
||
error messages.
|
||
-e --expand Use this flag to show full diffs instead of a
|
||
patch.
|
||
--filter Path to a module exporting a filtering
|
||
function. This method receives a list of tests
|
||
which can be manipulated to exclude tests from
|
||
running. Especially useful when used in
|
||
conjunction with a testing infrastructure to
|
||
filter known broken tests.
|
||
--findRelatedTests Find related tests for a list of source files
|
||
that were passed in as arguments. Useful for
|
||
pre-commit hook integration to run the minimal
|
||
amount of tests necessary.
|
||
--forceExit Force Jest to exit after all tests have
|
||
completed running. This is useful when
|
||
resources set up by test code cannot be
|
||
adequately cleaned up.
|
||
--globalSetup The path to a module that runs before All
|
||
Tests.
|
||
--globalTeardown The path to a module that runs after All Tests.
|
||
--globals A JSON string with map of global variables that
|
||
need to be available in all test environments.
|
||
--haste A JSON string with map of variables for the
|
||
haste module system
|
||
--init Generate a basic configuration file
|
||
--injectGlobals Should Jest inject global variables or not
|
||
--json Prints the test results in JSON. This mode will
|
||
send all other test output and user messages to
|
||
stderr.
|
||
--lastCommit Run all tests affected by file changes in the
|
||
last commit made. Behaves similarly to
|
||
`--onlyChanged`.
|
||
--listTests Lists all tests Jest will run given the
|
||
arguments and exits. Most useful in a CI system
|
||
together with `--findRelatedTests` to determine
|
||
the tests Jest will run based on specific files
|
||
--logHeapUsage Logs the heap usage after every test. Useful to
|
||
debug memory leaks. Use together with
|
||
`--runInBand` and `--expose-gc` in node.
|
||
--mapCoverage Maps code coverage reports against original source code when transformers supply source maps.
|
||
|
||
DEPRECATED
|
||
--maxConcurrency Specifies the maximum number of tests that are
|
||
allowed to runconcurrently. This only affects
|
||
tests using `test.concurrent`.
|
||
-w --maxWorkers Specifies the maximum number of workers the
|
||
worker-pool will spawn for running tests. This
|
||
defaults to the number of the cores available
|
||
on your machine. (its usually best not to
|
||
override this default)
|
||
--moduleDirectories An array of directory names to be searched
|
||
recursively up from the requiring module's
|
||
location.
|
||
--moduleFileExtensions An array of file extensions your modules use.
|
||
If you require modules without specifying a
|
||
file extension, these are the extensions Jest
|
||
will look for.
|
||
--moduleNameMapper A JSON string with a map from regular
|
||
expressions to module names or to arrays of
|
||
module names that allow to stub out resources,
|
||
like images or styles with a single module
|
||
--modulePathIgnorePatterns An array of regexp pattern strings that are
|
||
matched against all module paths before those
|
||
paths are to be considered "visible" to the
|
||
module loader.
|
||
--modulePaths An alternative API to setting the NODE_PATH env
|
||
variable, modulePaths is an array of absolute
|
||
paths to additional locations to search when
|
||
resolving modules.
|
||
--noStackTrace Disables stack trace in test results output
|
||
--notify Activates notifications for test results.
|
||
--notifyMode Specifies when notifications will appear for
|
||
test results.
|
||
-o --onlyChanged Attempts to identify which tests to run based
|
||
on which files have changed in the current
|
||
repository. Only works if you're running tests
|
||
in a git or hg repository at the moment.
|
||
-f --onlyFailures Run tests that failed in the previous
|
||
execution.
|
||
--outputFile Write test results to a file when the --json
|
||
option is also specified.
|
||
--passWithNoTests Will not fail if no tests are found (for
|
||
example while using `--testPathPattern`.)
|
||
--preset A preset that is used as a base for Jest's
|
||
configuration.
|
||
--prettierPath The path to the "prettier" module used for
|
||
inline snapshots.
|
||
--projects A list of projects that use Jest to run all
|
||
tests of all projects in a single instance of
|
||
Jest.
|
||
--reporters A list of custom reporters for the test suite.
|
||
--resetMocks Automatically reset mock state between every
|
||
test. Equivalent to calling
|
||
jest.resetAllMocks() between each test.
|
||
--resetModules If enabled, the module registry for every test
|
||
file will be reset before running each
|
||
individual test.
|
||
--resolver A JSON string which allows the use of a custom
|
||
resolver.
|
||
--restoreMocks Automatically restore mock state and
|
||
implementation between every test. Equivalent
|
||
to calling jest.restoreAllMocks() between each
|
||
test.
|
||
--rootDir The root directory that Jest should scan for
|
||
tests and modules within.
|
||
--roots A list of paths to directories that Jest should
|
||
use to search for files in.
|
||
-i --runInBand Run all tests serially in the current process
|
||
(rather than creating a worker pool of child
|
||
processes that run tests). This is sometimes
|
||
useful for debugging, but such use cases are
|
||
pretty rare.
|
||
--runTestsByPath Used when provided patterns are exact file
|
||
paths. This avoids converting them into a
|
||
regular expression and matching it against
|
||
every single file.
|
||
--runner Allows to use a custom runner instead of Jest's
|
||
default test runner.
|
||
--selectProjects Run only the tests of the specified
|
||
projects.Jest uses the attribute `displayName`
|
||
in the configuration to identify each project.
|
||
--setupFiles A list of paths to modules that run some code
|
||
to configure or set up the testing environment
|
||
before each test.
|
||
--setupFilesAfterEnv A list of paths to modules that run some code
|
||
to configure or set up the testing framework
|
||
before each test
|
||
--showConfig Print your jest config and then exits.
|
||
--silent Prevent tests from printing messages through
|
||
the console.
|
||
--skipFilter Disables the filter provided by --filter.
|
||
Useful for CI jobs, or local enforcement when
|
||
fixing tests.
|
||
--snapshotSerializers A list of paths to snapshot serializer modules
|
||
Jest should use for snapshot testing.
|
||
--testEnvironment Alias for --env
|
||
--testEnvironmentOptions Test environment options that will be passed to
|
||
the testEnvironment. The relevant options
|
||
depend on the environment.
|
||
--testFailureExitCode Exit code of `jest` command if the test run
|
||
failed
|
||
--testLocationInResults Add `location` information to the test results
|
||
--testMatch The glob patterns Jest uses to detect test
|
||
files.
|
||
-t --testNamePattern Run only tests with a name that matches the
|
||
regex pattern.
|
||
--testPathIgnorePatterns An array of regexp pattern strings that are
|
||
matched against all test paths before executing
|
||
the test. If the test path matches any of the
|
||
patterns, it will be skipped.
|
||
--testPathPattern A regexp pattern string that is matched against
|
||
all tests paths before executing the test.
|
||
--testRegex A string or array of string regexp patterns
|
||
that Jest uses to detect test files.
|
||
--testResultsProcessor Allows the use of a custom results processor.
|
||
This processor must be a node module that
|
||
exports a function expecting as the first
|
||
argument the result object.
|
||
--testRunner Allows to specify a custom test runner. The
|
||
default is `jasmine2`. A path to a custom test
|
||
runner can be provided:
|
||
`<rootDir>/path/to/testRunner.js`.
|
||
--testSequencer Allows to specify a custom test sequencer. The
|
||
default is `@jest/test-sequencer`. A path to a
|
||
custom test sequencer can be provided:
|
||
`<rootDir>/path/to/testSequencer.js`
|
||
--testTimeout This option sets the default timeouts of test
|
||
cases.
|
||
--testURL This option sets the URL for the jsdom
|
||
environment.
|
||
--timers Setting this value to fake allows the use of
|
||
fake timers for functions such as setTimeout.
|
||
--transform A JSON string which maps from regular
|
||
expressions to paths to transformers.
|
||
--transformIgnorePatterns An array of regexp pattern strings that are
|
||
matched against all source file paths before
|
||
transformation.
|
||
--unmockedModulePathPatterns An array of regexp pattern strings that are
|
||
matched against all modules before the module
|
||
loader will automatically return a mock for
|
||
them.
|
||
-u --updateSnapshot Use this flag to re-record snapshots. Can be
|
||
used together with a test suite pattern or with
|
||
`--testNamePattern` to re-record snapshot for
|
||
test matching the pattern
|
||
--useStderr Divert all output to stderr.
|
||
--verbose Display individual test results with the test
|
||
suite hierarchy.
|
||
--watch Watch files for changes and rerun tests related
|
||
to changed files. If you want to re-run all
|
||
tests when a file has changed, use the
|
||
`--watchAll` option.
|
||
--watchAll Watch files for changes and rerun all tests. If
|
||
you want to re-run only the tests related to
|
||
the changed files, use the `--watch` option.
|
||
--watchPathIgnorePatterns An array of regexp pattern strings that are
|
||
matched against all paths before trigger test
|
||
re-run in watch mode. If the test path matches
|
||
any of the patterns, it will be skipped.
|
||
--watchman Whether to use watchman for file crawling.
|
||
Disable using --no-watchman.
|
||
-h, --help display help for command
|
||
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br><span class="line-number">2</span><br><span class="line-number">3</span><br><span class="line-number">4</span><br><span class="line-number">5</span><br><span class="line-number">6</span><br><span class="line-number">7</span><br><span class="line-number">8</span><br><span class="line-number">9</span><br><span class="line-number">10</span><br><span class="line-number">11</span><br><span class="line-number">12</span><br><span class="line-number">13</span><br><span class="line-number">14</span><br><span class="line-number">15</span><br><span class="line-number">16</span><br><span class="line-number">17</span><br><span class="line-number">18</span><br><span class="line-number">19</span><br><span class="line-number">20</span><br><span class="line-number">21</span><br><span class="line-number">22</span><br><span class="line-number">23</span><br><span class="line-number">24</span><br><span class="line-number">25</span><br><span class="line-number">26</span><br><span class="line-number">27</span><br><span class="line-number">28</span><br><span class="line-number">29</span><br><span class="line-number">30</span><br><span class="line-number">31</span><br><span class="line-number">32</span><br><span class="line-number">33</span><br><span class="line-number">34</span><br><span class="line-number">35</span><br><span class="line-number">36</span><br><span class="line-number">37</span><br><span class="line-number">38</span><br><span class="line-number">39</span><br><span class="line-number">40</span><br><span class="line-number">41</span><br><span class="line-number">42</span><br><span class="line-number">43</span><br><span class="line-number">44</span><br><span class="line-number">45</span><br><span class="line-number">46</span><br><span class="line-number">47</span><br><span class="line-number">48</span><br><span class="line-number">49</span><br><span class="line-number">50</span><br><span class="line-number">51</span><br><span class="line-number">52</span><br><span class="line-number">53</span><br><span class="line-number">54</span><br><span class="line-number">55</span><br><span class="line-number">56</span><br><span class="line-number">57</span><br><span class="line-number">58</span><br><span class="line-number">59</span><br><span class="line-number">60</span><br><span class="line-number">61</span><br><span class="line-number">62</span><br><span class="line-number">63</span><br><span class="line-number">64</span><br><span class="line-number">65</span><br><span class="line-number">66</span><br><span class="line-number">67</span><br><span class="line-number">68</span><br><span class="line-number">69</span><br><span class="line-number">70</span><br><span class="line-number">71</span><br><span class="line-number">72</span><br><span class="line-number">73</span><br><span class="line-number">74</span><br><span class="line-number">75</span><br><span class="line-number">76</span><br><span class="line-number">77</span><br><span class="line-number">78</span><br><span class="line-number">79</span><br><span class="line-number">80</span><br><span class="line-number">81</span><br><span class="line-number">82</span><br><span class="line-number">83</span><br><span class="line-number">84</span><br><span class="line-number">85</span><br><span class="line-number">86</span><br><span class="line-number">87</span><br><span class="line-number">88</span><br><span class="line-number">89</span><br><span class="line-number">90</span><br><span class="line-number">91</span><br><span class="line-number">92</span><br><span class="line-number">93</span><br><span class="line-number">94</span><br><span class="line-number">95</span><br><span class="line-number">96</span><br><span class="line-number">97</span><br><span class="line-number">98</span><br><span class="line-number">99</span><br><span class="line-number">100</span><br><span class="line-number">101</span><br><span class="line-number">102</span><br><span class="line-number">103</span><br><span class="line-number">104</span><br><span class="line-number">105</span><br><span class="line-number">106</span><br><span class="line-number">107</span><br><span class="line-number">108</span><br><span class="line-number">109</span><br><span class="line-number">110</span><br><span class="line-number">111</span><br><span class="line-number">112</span><br><span class="line-number">113</span><br><span class="line-number">114</span><br><span class="line-number">115</span><br><span class="line-number">116</span><br><span class="line-number">117</span><br><span class="line-number">118</span><br><span class="line-number">119</span><br><span class="line-number">120</span><br><span class="line-number">121</span><br><span class="line-number">122</span><br><span class="line-number">123</span><br><span class="line-number">124</span><br><span class="line-number">125</span><br><span class="line-number">126</span><br><span class="line-number">127</span><br><span class="line-number">128</span><br><span class="line-number">129</span><br><span class="line-number">130</span><br><span class="line-number">131</span><br><span class="line-number">132</span><br><span class="line-number">133</span><br><span class="line-number">134</span><br><span class="line-number">135</span><br><span class="line-number">136</span><br><span class="line-number">137</span><br><span class="line-number">138</span><br><span class="line-number">139</span><br><span class="line-number">140</span><br><span class="line-number">141</span><br><span class="line-number">142</span><br><span class="line-number">143</span><br><span class="line-number">144</span><br><span class="line-number">145</span><br><span class="line-number">146</span><br><span class="line-number">147</span><br><span class="line-number">148</span><br><span class="line-number">149</span><br><span class="line-number">150</span><br><span class="line-number">151</span><br><span class="line-number">152</span><br><span class="line-number">153</span><br><span class="line-number">154</span><br><span class="line-number">155</span><br><span class="line-number">156</span><br><span class="line-number">157</span><br><span class="line-number">158</span><br><span class="line-number">159</span><br><span class="line-number">160</span><br><span class="line-number">161</span><br><span class="line-number">162</span><br><span class="line-number">163</span><br><span class="line-number">164</span><br><span class="line-number">165</span><br><span class="line-number">166</span><br><span class="line-number">167</span><br><span class="line-number">168</span><br><span class="line-number">169</span><br><span class="line-number">170</span><br><span class="line-number">171</span><br><span class="line-number">172</span><br><span class="line-number">173</span><br><span class="line-number">174</span><br><span class="line-number">175</span><br><span class="line-number">176</span><br><span class="line-number">177</span><br><span class="line-number">178</span><br><span class="line-number">179</span><br><span class="line-number">180</span><br><span class="line-number">181</span><br><span class="line-number">182</span><br><span class="line-number">183</span><br><span class="line-number">184</span><br><span class="line-number">185</span><br><span class="line-number">186</span><br><span class="line-number">187</span><br><span class="line-number">188</span><br><span class="line-number">189</span><br><span class="line-number">190</span><br><span class="line-number">191</span><br><span class="line-number">192</span><br><span class="line-number">193</span><br><span class="line-number">194</span><br><span class="line-number">195</span><br><span class="line-number">196</span><br><span class="line-number">197</span><br><span class="line-number">198</span><br><span class="line-number">199</span><br><span class="line-number">200</span><br><span class="line-number">201</span><br><span class="line-number">202</span><br><span class="line-number">203</span><br><span class="line-number">204</span><br><span class="line-number">205</span><br><span class="line-number">206</span><br><span class="line-number">207</span><br><span class="line-number">208</span><br><span class="line-number">209</span><br><span class="line-number">210</span><br><span class="line-number">211</span><br><span class="line-number">212</span><br><span class="line-number">213</span><br><span class="line-number">214</span><br><span class="line-number">215</span><br><span class="line-number">216</span><br><span class="line-number">217</span><br><span class="line-number">218</span><br><span class="line-number">219</span><br><span class="line-number">220</span><br><span class="line-number">221</span><br><span class="line-number">222</span><br><span class="line-number">223</span><br><span class="line-number">224</span><br><span class="line-number">225</span><br><span class="line-number">226</span><br><span class="line-number">227</span><br><span class="line-number">228</span><br><span class="line-number">229</span><br><span class="line-number">230</span><br><span class="line-number">231</span><br><span class="line-number">232</span><br><span class="line-number">233</span><br><span class="line-number">234</span><br><span class="line-number">235</span><br><span class="line-number">236</span><br><span class="line-number">237</span><br><span class="line-number">238</span><br><span class="line-number">239</span><br><span class="line-number">240</span><br><span class="line-number">241</span><br><span class="line-number">242</span><br><span class="line-number">243</span><br><span class="line-number">244</span><br><span class="line-number">245</span><br><span class="line-number">246</span><br><span class="line-number">247</span><br><span class="line-number">248</span><br><span class="line-number">249</span><br><span class="line-number">250</span><br><span class="line-number">251</span><br><span class="line-number">252</span><br><span class="line-number">253</span><br><span class="line-number">254</span><br><span class="line-number">255</span><br><span class="line-number">256</span><br><span class="line-number">257</span><br><span class="line-number">258</span><br><span class="line-number">259</span><br><span class="line-number">260</span><br><span class="line-number">261</span><br><span class="line-number">262</span><br><span class="line-number">263</span><br><span class="line-number">264</span><br><span class="line-number">265</span><br><span class="line-number">266</span><br><span class="line-number">267</span><br><span class="line-number">268</span><br><span class="line-number">269</span><br><span class="line-number">270</span><br><span class="line-number">271</span><br><span class="line-number">272</span><br><span class="line-number">273</span><br><span class="line-number">274</span><br><span class="line-number">275</span><br><span class="line-number">276</span><br><span class="line-number">277</span><br><span class="line-number">278</span><br><span class="line-number">279</span><br><span class="line-number">280</span><br><span class="line-number">281</span><br><span class="line-number">282</span><br><span class="line-number">283</span><br><span class="line-number">284</span><br><span class="line-number">285</span><br><span class="line-number">286</span><br></div></div><p>比如覆盖测试:</p><div class="language-text ext-text line-numbers-mode"><pre class="language-text"><code>fes test --coverage
|
||
</code></pre><div class="line-numbers"><span class="line-number">1</span><br></div></div><h3 id="配置文件" tabindex="-1"><a class="header-anchor" href="#配置文件" aria-hidden="true">#</a> 配置文件</h3><p>除了插件内置的默认配置之外,插件遵循 <code>Jest</code>的配置文件规范,约定项目根目录下的 <code>jest.config.js</code> 为用户配置文件,约定 <code>packages.json</code> 的 <code>jest</code> 属性内容也是配置。</p><h3 id="优先级" tabindex="-1"><a class="header-anchor" href="#优先级" aria-hidden="true">#</a> 优先级</h3><p><code>args</code> 配置 > <code>package.json</code>中的 <code>jest</code> > <code>jest.config.js</code> > 默认配置</p><!--]--></div><footer class="page-meta"><div class="meta-item edit-link"><a class="nav-link external meta-item-label" href="https://github.com/WeBankFinTech/fes.js/edit/vue3/docs/reference/plugin/plugins/jest.md" rel="noopener noreferrer" target="_blank" aria-label="在 GitHub 上编辑此页"><!--[--><!--]--> 在 GitHub 上编辑此页 <span><svg class="icon outbound" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewbox="0 0 100 100" width="15" height="15"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path><polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg><!--[--><span class="sr-only">在新窗口打开</span><!--]--></span><!--[--><!--]--></a></div><div class="meta-item last-updated"><span class="meta-item-label">上次更新: </span><!----></div><div class="meta-item contributors"><span class="meta-item-label">贡献者: </span><span class="meta-item-info"><!--[--><!--[--><span class="contributor" title="email: 445436867@qq.com">harrywan</span><!----><!--]--><!--]--></span></div></footer><nav class="page-nav"><p class="inner"><span class="prev"><a href="/fes.js/reference/plugin/plugins/icon.html" class="nav-link" aria-label="@fesjs/plugin-icon"><!--[--><!--]--> @fesjs/plugin-icon <!--[--><!--]--></a></span><span class="next"><a href="/fes.js/reference/plugin/plugins/layout.html" class="nav-link" aria-label="@fesjs/plugin-layout"><!--[--><!--]--> @fesjs/plugin-layout <!--[--><!--]--></a></span></p></nav><!--[--><!--]--></main><!--]--></div><!----><!----><!--]--></div>
|
||
<script src="/fes.js/assets/js/runtime~app.e7cf0416.js" defer></script><script src="/fes.js/assets/js/519.22262c34.js" defer></script><script src="/fes.js/assets/js/app.704a6fe6.js" defer></script>
|
||
</body>
|
||
</html>
|