- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我的测试结构如下
describe('Test Suite'){
describe('First Test Case'){
it('1st step'){};
it('2nd step'){};
it('3rd step'){};
}
describe('Second Test Case'){
it('1st step'){};
it('2nd step'){};
it('3rd step'){};
}
}
我想使用 --bail 这样如果在第一个测试用例中任何 it() 失败那么 describe() 应该被保释。但是第二个测试用例应该运行。
我通过使用得到了预期的结果:
describe('Test Suite'){
this.bail(false)
describe('First Test Case'){
this.bail(true);
it('1st step'){};
it('2nd step'){};
it('3rd step'){};
}
describe('Second Test Case'){
this.bail(true);
it('1st step'){};
it('2nd step'){};
it('3rd step'){};
}
}
如果不在每个 describe() 中显式地将 bail 分配给 true,是否还有其他方法可以做到这一点?
最佳答案
我找到了解决方法,也许它会有所帮助。
您可以不通过文件而是通过我的函数名称或测试名称来设置您的条件。
在设置文件中:
const FAILED_TESTS = {};
// Skip test if first test from folder failed
beforeEach(function() {
if (FAILED_TESTS[this.currentTest.file]) {
this.skip();
}
});
afterEach(function() {
if (this.currentTest.state === "failed") {
FAILED_TESTS[this.currentTest.file] = true;
}
});
关于javascript - Mocha :How to bail only failed describe() in nested describe()?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44646751/
我收到以下错误: In file included from generated/tandembiginteger.cpp:2: generated/tandembiginteger.h:26: er
Map-reduce作业失败,Reducer上出现以下错误 Error: org.apache.hadoop.mapreduce.task.reduce.Shuffle$ShuffleError: e
我是 hadoop 的新手,我正在尝试执行 wordcount 示例。我的计算机上有一个由虚拟机组成的 4 个节点的集群。每次作业完成 map 任务但 reduce 任务在大约 16% 时显示此错误:
根据 Laravel Documentation , bail规则应在第一次验证失败后停止运行验证规则。 我在 App\Http\* 外面有一个文件包含以下代码的命名空间: if(Validator:
我在尝试使用多个输入文件运行 MapReduce 作业时遇到以下错误。尽管我可以只使用一个输入文件来运行 MapReduce 作业。我浏览了一些帖子,几乎每个人都说存在防火墙问题或未在/etc/hos
我的测试结构如下 describe('Test Suite'){ describe('First Test Case'){ it('1st step'){};
当我尝试通过 WinRM 模块连接到我的 Windows 主机时,我在 Ansible 中得到执行“连接被拒绝”。 有ansible目录的结构: 命令: user@ansible:~/git/ansi
安装 Sentry 8.0.0: pip install -e . 出现以下错误: running [webpack] Container#eachAtRule is deprecated. Use
我对 Jest 还很陌生。使用版本16.0.1。 我有一个包含 3 个测试的测试套件。我专注于其中一项失败的测试。我的理解是,Jest 应该在运行非失败测试之前尝试失败测试(根据 Jest 主页:“J
当我尝试使用 bail(false) 开始我的 mocha 测试时,我需要不停止测试,即使某些 beforeEach 钩子(Hook)给出错误。 但这没有帮助,有人更早处理过这个问题吗?或者..这可能
我正在尝试使用 Apple 的一些 source code ,但代码中充斥着这些语句: require( error == nil, bail ); 在 ARC 项目中使用时会导致各种错误(“转到 p
我已经使用来自以下站点的手册将 hadoop 安装并配置为单个节点。 http://www.michael-noll.com/tutorials/running-hadoop-on-ubuntu-li
我从使用标准 Angular/systemjs 的英雄之旅开始。现在我正在为它使用 angular-client 并且它在开发/生产模式下顺利运行。但是我无法用 ng test 测试任何东西。以下内容
我尝试使用记录 CPU 使用率的 Chrome JS Profiler 运行我的应用程序,我收到了一些警告,其中有一些“ForInStatement is not fast case”,我已经修复了,
我正在查看 Square Cam in Apple's sample code 的一些示例代码.我想在使用 ARC 的现代项目中复制它的一些功能。但是,有大量的 require 语句,例如: BOOL
我有一个 hadoop 0.20 map/reduce 作业,过去运行得很好。最近几天卡在reduce阶段16.66%,我在jobtracker查看reduce任务时看到如下错误; Shuffle E
我想使用 optaplanner 的“pin”功能进行固定操作。但是我得到“摆脱永无止境的选择器(过滤(FromSolutionEntitySelector(PersonAssignment)))以避
我已经红色了 optaplanner 文档,@PlanningPin 的用法非常简单。我的 PlanningEntity 是: @PlanningEntity() public class CrewG
我是一名优秀的程序员,十分优秀!