picklesdoc / pickles

The open source living documentation generator
http://www.picklesdoc.com/
Apache License 2.0
464 stars 164 forks source link

Javascript error in dhtml doc #553

Closed 0x6C6F closed 6 years ago

0x6C6F commented 6 years ago

The dhtml report is not shown in TeamCity and is blocked with the message "Loading..."

2018-10-15_17h23_32

Pickles.MSBuild 2.20.0, Specflow 2.4.0, NUnit 3.11.0, TeamCity 2017.2.2

The browser console (Chrome 69) contains the following Javascript error:

knockout-3.4.0.js:72 Uncaught ReferenceError: Unable to process binding "template: function(){return { name:'featuresByFolder-template',foreach:featuresByFolder().SubDirectories} }"
Message: Unable to process binding "template: function(){return { name:'features-template',foreach:features} }"
Message: Unable to process binding "template: function(){return { name:'testResults-template',data:Result} }"
Message: Unable to process binding "if: function(){return (WasExecuted && WasProvided) }"
Message: WasProvided is not defined
    at if (eval at parseBindingsString (knockout-3.4.0.js:68), <anonymous>:3:78)
    at a.m.i (knockout-3.4.0.js:8)
    at Function.Pc (knockout-3.4.0.js:51)
    at Function.Qc (knockout-3.4.0.js:51)
    at Function.aa (knockout-3.4.0.js:50)
    at Object.a.m.a.B (knockout-3.4.0.js:49)
    at init (knockout-3.4.0.js:8)
    at knockout-3.4.0.js:72
    at Object.w (knockout-3.4.0.js:39)
    at knockout-3.4.0.js:71

After some analyses I see that in the files -- dhtml\js\featuresModel.js -- dhtml\js\heirarchyBuilder.js the "WasProvided" variable was not initialized. This is in contrast to "WasExecuted" and "WasSuccessful".

In combination with the generated index.html file (see extract below) where the variable was used, this leads to the above error.

<script type="text/html" id="testResults-template">
    <div style="float: right" data-bind="if: (WasExecuted && WasProvided)">
        <div data-bind="if: WasSuccessful"><span class="badge badge-success"><i class="icon-ok passed" title="Passed"></i></span></div>
        <div data-bind="if: !WasSuccessful"><span class="badge badge-important"><i class="icon-minus-sign failed" title="Failed"></i></span></div>
    </div>
    <div style="float: right" data-bind="if: (!WasExecuted && WasExecuted)">
        <span class="badge badge-warning"><i class="icon-warning-sign inconclusive" title="Inconclusive"></i></span>
    </div>
</script>
dirkrombauts commented 6 years ago

Thanks for the bug report and the investigation - that is very helpful!

dirkrombauts commented 6 years ago

I will release a new version of Pickles later this week.

dirkrombauts commented 6 years ago

I released a fix in version 2.20.1.