Custom Jasmine reporter in Protractor tests

2019-02-11 17:40发布

I can not find how to change reporter style in protractors runner using jasmine framework.

What I have right now is:

enter image description here

But I would like something more like:

enter image description here

Is there a way to add custom reporter for jasmine that would show current test running instead of DOTS and Fs?

4条回答
倾城 Initia
2楼-- · 2019-02-11 18:15

To extend @fer's answer:

You can add these settings to jasmineNodeOpts to both see the current test and get stack trace right when test fails:

  jasmineNodeOpts: {
    showColors: true,
    isVerbose: true,
    realtimeFailure: true,
    includeStackTrace: true,
    defaultTimeoutInterval: 30000
  },
查看更多
别忘想泡老子
3楼-- · 2019-02-11 18:27

I am building a jasmine reporter that does exactly what you want, jasmine-spec-reporter.

查看更多
何必那么认真
4楼-- · 2019-02-11 18:27

Add the isVerbose flag to the protractor config, it's false by default:

exports.config = {
  . . .

  // Options to be passed to Jasmine-node.
  jasmineNodeOpts: {
    showColors: true,
    defaultTimeoutInterval: 30000,
    isVerbose: true
  }
};
查看更多
The star\"
5楼-- · 2019-02-11 18:40

Add this dependency to your project:
npm install jasmine-spec-reporter --save-dev

And add this to your config file:

onPrepare: function(){
    var SpecReporter = require('jasmine-spec-reporter').SpecReporter;
    jasmine.getEnv().addReporter(new SpecReporter({displayStacktrace: 'all'}));
}
查看更多
登录 后发表回答