Background: I'm using Jasmine as my test framework for Protractor, I've been using jasmine spec reporter for reporting. Yesterday I slightly changed my jasmineNodeOpts
parameters in my protractor conf.js to include the print()
function i.e.
jasmineNodeOpts: {
showColors: true,
defaultTimeoutInterval: 120000,
includeStackTrace : true,
isVerbose : true,
print: function () {}
},
I added this print function because I learned it would remove the .
before each report. For example, my test reports used to come back:
. ✓ should display a profile question about IT loads
. ✓ checks the width of the progress bar
. ✓ selects an option from the radio buttons and updates the progress bar
And now those leading dots are removed. However, now my final report has also slight changed from:
14 specs, 2 failures Finished in 45.473 seconds // this is the old, desired output
To this:
Executed 14 of 14 specs (2 FAILED) in 45 secs. // this is my current, undesired output
I want the best of both worlds, having the .
removed from my report but retaining the previous overall report.
Problem: I cannot find detailed documentation on jasmineNodeOpts
and/or that print()
function. It is mentioned in jasmine-spec-reporter and the protractor reference conf but there is no real documentation on how it works, only very weak examples are provided.
Does anyone know where I can learn more about this print()
function and/or how to change my final test output?
I have one solution for this case. This is kind of a hack, a small change in the jasmine-spec-reporter - displaySummary logic
Replace the method - summary(metrics)
at node_modules/jasmine-spec-reporter/src/spec-display.js
with the below logic
summary: function (metrics) {
this.log(metrics.executedSpecs + ' specs, ' + metrics.failedSpecs+ ' failures Finished in ' + metrics.duration);
if (metrics.random) {
this.log('Randomized with seed ' + metrics.seed + '.');
}
},
I just checked and its generating the execution summary as you are expecting
Spec started
- sample test
√ Dummy Test
√ Dummy Test2
√ Dummy Test3
3 specs, 0 failures
Finished in 27.544 seconds
3 specs,0 failures Finished in 28 secs
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With