【问题标题】:protractor fdescribe and fit does not work with jasmine-reporters量角器 fdescribe 和 fit 不适用于 jasmine-reporters
【发布时间】:2015-03-07 00:29:21
【问题描述】:

我的 conf.js 中有这个

onPrepare: function() {
    /**if comment out then spec runs, if uncomment then spec doesn't run
    var jasmineReporters = require('jasmine-reporters');
    jasmine.getEnv().addReporter(new jasmineReporters.JUnitXmlReporter({
    consolidateAll: true,
    filePrefix: 'portal_tests_xmloutput',
        savePath: './test_results_report'
      })); **/
    },      
};

在我的 test_spec.js 中有

fdescribe('my tests', function() {

it('test1', function(){
});

fit('test2', function(){
});

it('test3', function(){
});

}

当我运行我的测试时,它会输出

[launcher] Running 1 instances of WebDriver
Started


No specs found
Finished in 0.002 seconds

如果我在我的 conf.js 中注释掉 jasmine 记者声明并再次运行,它将运行正确的测试并输出

[launcher] Running 1 instances of WebDriver
Started
test2
.


1 spec, 0 failures
Finished in 5.675 seconds

为什么 jasmine-reporters 会干扰重点规范测试?我希望在使用 fdescribe 和 fit 运行时启用 jasmine-reporters。我正在使用

量角器:1.8.0 茉莉花记者:2.0.4

【问题讨论】:

    标签: jasmine protractor


    【解决方案1】:

    问题在jasmine-reporters@2.0.5解决。

    显然在使用fit 时,jasmine 不会调用suiteStartedsuiteDone 回调。 jasmine-reporters 依赖于被调用的这些方法,结果被炸毁了。从 2.0.5 开始,它现在会尝试检测这些方法是否已被调用并进行调整。

    【讨论】:

    • 不错的收获 - 想知道它为什么停止工作。升级并没有为我解决这个问题。
    【解决方案2】:

    您是否在配置文件中提供了framework='jasmine2' 设置? https://github.com/angular/protractor/blob/master/docs/referenceConf.js#L253

    【讨论】:

      猜你喜欢
      • 2015-09-27
      • 2015-11-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-11-13
      相关资源
      最近更新 更多