dgarlitt / karma-nyan-reporter

Nyan Cat style reporter based on the Mocha version
MIT License
169 stars 19 forks source link

Template parse errors don't appear in report (Angular 2 project) #26

Open whyboris opened 7 years ago

whyboris commented 7 years ago

In an Angular 2 project, when running tests with progress reporter, errors such as this:

Template parse errors:
The pipe `capitalizeFirstLetter` could not be found ...

do not show up in the nyan reporter.

I have a fix for this; please see https://github.com/dgarlitt/karma-nyan-reporter/pull/27

The issue occurs here: DataStore.prototype.saveResultToSuite = function(suite, browser, result) { in the result object. Specifically result.log is an array of strings (errors) which typically contains one long string that is later parsed. The Template parse errors end up as a second element of this array. And currently, only the first element is saved: brwsr.errors = result.log[0].split('\n');

My solution is to include a conditional to check if there is more than one element in the array, and if so, concatenate them to the first element so that all errors get displayed correctly in the log.