How to disable stack error message?

During the launch of the test layout, when something fails, it also displays a stack message like this

Failures:
1) Should validate labels
    Message: 
      Failed: No element found using locator: By.cssSelector(".container h1")
    Stack:
      NoSuchElementError: No element found .........................
      .........
     ......
      ....

can this stack output be disabled? I tried

protractor conf.js --no-stackTrace

also updated conf.js file with settings

stackTrace: false,
  // Options to be passed to Jasmine.
  jasmineNodeOpts: {
    defaultTimeoutInterval: 30000,
    includeStackTrace: false,
  }

but always shows stack output, how to fix it?

+4
source share
4 answers

If you are using an old protractor (<= 1.4, I think), for you will work as isVerbosewell as includeStackTraceto false:

jasmineNodeOpts: {
  isVerbose: false,
  includeStackTrace: false
}

Unfortunately, currently isVerboseor includeStackTracewill not be recognized in jasmineNodeOpts(explanation here ):

jasmine 1.3, jasmineNodeOpts . , " https://github.com/juliemr/minijasminenode" " https://github.com/jasmine/jasmine-npm", . , print grep , isVerbose includeStackTrace ( , "jasmine-npm" ).

. :

+3

Stacktraces , "conf.js":

    ...

    framework: 'jasmine',

    // Options to be passed to Jasmine-node.
    jasmineNodeOpts: {
        // If true, display spec names.
        isVerbose : false,

        // Use colors in the command line report.
        showColors: true,

        // If true, include stack traces in failures.
        includeStackTrace : false,

        // Default time to wait in ms before a test fails.
        defaultTimeoutInterval: 60000,

        // If true, print timestamps for failures
        showTiming: true,

        // Print failures in real time.
        realtimeFailure: true
    }

    ...

GitHub (https://github.com/angular/protractor/issues/696) . "isVerbose", "includeStackTrace" "false".

+1

, , github https://github.com/bcaudan/jasmine-spec-reporter/blob/master/docs/protractor-configuration.md

jasmineNodeOpts

jasmineNodeOpts: {
   ...
   print: function() {}
}

0

includeStackTrace https://github.com/angular/protractor/commit/bf5b076cb8897d844c25baa91c263a12c61e3ab3 .

The jasmine-spec-reporter has changed and no longer has the protractor-configuration.md file, so the tip no longer worked for me.

However, despite the absence of the protractor-configuration.md file, I found that jasmine-spec-reporter has a working solution for me. I found that using jasmine-spec-reporter this way with Protractor 5.2.0 in my configuration file:

setup = function() {

    var jasmineReporters = require('jasmine-reporters');

    jasmine.getEnv().addReporter(new jasmineReporters.TerminalReporter({
         verbosity: 3,
         color: true,
         showStack: false }));
}

exports.config = {
    onPrepare: setup

};

The key was to change the parameter stackTraceto false inTerminalReporter

0
source

Source: https://habr.com/ru/post/1607627/


All Articles