Angular Jasmine 2.0测试熟悉度,Pending()无法在身体和它中进行重新调整('无功能错误');

时间:2015-05-05 14:45:33

标签: angularjs jasmine karma-jasmine

转到Jasmine 2.x,我正在测试待定规格。我试图在规范体中使用pending()失败并且我发现它('没有函数')正在抛出

错误:undefined不是函数。

xit工作正常

当所有规格都标记为xit()时,我没有计算待处理的规格

    0 tests, 0 assertions, 0 failures

代码

    describe("Pending specs", function() {

    //Any spec declared with xit is marked as pending.

      xit("can be declared 'xit'", function() {
        expect(true).toBe(false);
      });

    //Any spec declared without a function body will also be marked pending in results.

      it("can be declared with 'it' but without a function");

    //And if you call the function pending anywhere in the spec body, no matter the expectations, the spec will be marked pending.

      it("can be declared by calling 'pending' in the spec body", function() {
        expect(true).toBe(false);
        pending();
      });
    });

错误味精 失败:它(“可以用'它'声明,但没有函数”);

      1) Pending specs encountered a declaration exception
       Message:
         Error: undefined is not a function
       Stacktrace:
         Error: undefined is not a function

失败:待定()

评论错误的规范

pending()似乎没有阻止 执行的最后一个规格,我得到了一个 参考错误:未定义待处理

     Pending specs can be declared by calling 'pending' in the spec body
       Message:
         ReferenceError: pending is not defined
       Stacktrace:
         ReferenceError: pending is not defined

0 个答案:

没有答案