【问题标题】:Mark a Jasmine test as skipped while using the Karma-Jasmine provider in Karma-Runner?在 Karma-Runner 中使用 Karma-Jasmine 提供程序时将 Jasmine 测试标记为已跳过?
【发布时间】:2013-07-17 11:09:08
【问题描述】:

我正在使用 Karma 运行这个 jasmine 测试:

describe('When a logged in user chooses Rent and Payment PIN is enabled', function() {
    beforeEach(function(){

    });

    afterEach(function() {

    });

    it('should be presented with a dialog to enter the pin', function() {
       //test to be skipped
    })
})    

我想在报告中看到该测试已被跳过,并在测试所需的所有东西都准备好时回来测试。

我怎样才能做到这一点?

【问题讨论】:

  • 我也有同样的问题。跳过测试很容易(只需将 'it' 更改为 'xit'),但我还没有找到一种方法可以让我在运行 karma 时在报告中反映跳过测试的事实。
  • 我找到了一个关于它的issue on github。如果您仍然感兴趣,请在此处发表评论以吸引开发者的关注

标签: jasmine karma-runner karma-jasmine


【解决方案1】:

您可以尝试在规范中使用pending 函数。根据文档,待定规范不会运行,但名称仍会出现在结果中。对于 2.0,它还说空的方法体应该可以工作。试试:

it('should be presented with a dialog to enter the pin', function() {
   pending();
})

it('should be presented with a dialog to enter the pin');

【讨论】:

    猜你喜欢
    • 2013-05-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-03-26
    • 2015-12-07
    • 1970-01-01
    • 2018-11-13
    • 1970-01-01
    相关资源
    最近更新 更多