我想描述应该在代码中的规范,但稍后会添加它们的实现.在测试结果中,我希望看到它们既不会通过也不会失败,而是"正在等待"实施.
如果有可能在摩卡或茉莉花中开箱即用,我很感兴趣.
谢谢
小智 61
您可以使用xit(而不是it)和xdescribe(而不是describe)在mocha和jasmine中声明禁用的函数.
如果您希望测试显示为挂起,则在mocha中,您可以在调用it()函数时将第二个参数留空.例如:
describe('Something', function () {
it('Should be pending')
xit('Should be disabled, i.e not appear on the list')
});
Run Code Online (Sandbox Code Playgroud)
更新:如果发生此合并,则可能会在Mocha中更改xit/ 的行为xdescribe:https://github.com/visionmedia/mocha/pull/510
Sve*_*cke 22
从Jasmine 2.0开始,编写xit()而不是it()规范将其标记为待定(正如在已接受的答案的评论中已经说过的那样).
另外,pending()您可以在规范中的任何位置调用函数将其标记为挂起:
it("can be declared by calling 'pending' in the spec body", function() {
expect(true).toBe(false);
pending();
});
Run Code Online (Sandbox Code Playgroud)
另请参阅Jasmine 2.0中有关挂起规范的文档.
law*_*nce 15
在mocha中,您还可以使用skip:
describe('my module', function() {
it.skip('works', function() {
// nothing yet
});
});
Run Code Online (Sandbox Code Playgroud)
您也describe.skip可以跳过整个部分.
| 归档时间: |
|
| 查看次数: |
20720 次 |
| 最近记录: |