FineCodeCoverage icon indicating copy to clipboard operation
FineCodeCoverage copied to clipboard

Script error

Open viceice opened this issue 3 years ago • 5 comments

Installed product versions

  • Visual Studio: 2022 x64 17.1.6
  • This extension: 1.1.173 (fcc-f339fe606-9d51-4fca-895c-d50375137b62)

Description

Replace this text with a short description

Steps to recreate

  1. Open Project
  2. Open Test-Explorer
  3. Open FCC window undocked
  4. Run Tests
  5. Internet Explorer script error occures and click on coverage file fails

Current behavior

FCC window isn't working after running all tests.

image

When continue and then clicking on a file to see coverage it shows the following page.

image

Expected behavior

It should simply work.

Side Notes

It shouln't use the old internet explorer webview. Instead it should use the new Edge webview or an alternate Chromium / Gecko based webview.

https://docs.microsoft.com/en-us/microsoft-edge/webview2/get-started/wpf

viceice avatar May 09 '22 09:05 viceice

Please can you send the index.html and index-processed.html files from the fine-code-coverage / coverage-tool-output directory so that the error can be investigated.

Perhaps you can open index.html in internet explorer. If the error is present then it is a ReportGenerator error otherwise it is an error that FCC has introduced.

As per WebView2 - currently being worked on with custom report generation.

image

tonyhallett avatar May 09 '22 10:05 tonyhallett

Probably related to my .netconfig for reportgenerator

[ReportGenerator]
	reports = "**/TestResults/*/*.cobertura.xml;coverage/**/cobertura-coverage.xml"
	targetdir = ".coverage/"
	reporttypes = "TextSummary;Cobertura;Html"
        historydir  = ".coverage/history/"

Will send html files soon

viceice avatar May 09 '22 10:05 viceice

Created a simple reproduction repo

https://github.com/viceice-tests/263-fcc-repro https://gist.github.com/viceice/48115722779abf0c0c8665b385dcc239

viceice avatar May 09 '22 11:05 viceice

The .netconfig is resulting in historic coverage.

The problem is this code

var charts = document.getElementsByClassName('historychart');
for (i = 0, l = charts.length; i < l; i++) {
  renderChart(charts[i]);
}
var renderChart = function (chart) {
    // Remove current children (e.g. PNG placeholder)
    while (chart.firstChild) {
        chart.firstChild.remove(); ********************************************************
    }

Possible solutions are

a) You remove historydir from .netconfig using the cli b) FCC passes the historydir command line argument to a directory that does not exist Prevents .netconfig https://github.com/danielpalme/ReportGenerator/blob/dc395da3825e07700c1a16defd89e0c00434d2fd/src/ReportGenerator.Core/ReportConfigurationBuilder.cs#L14

This is in try/catch so would proceed https://github.com/danielpalme/ReportGenerator/blob/dc395da3825e07700c1a16defd89e0c00434d2fd/src/ReportGenerator.Core/Reporting/History/HistoryParser.cs#L77

No historic coverages https://github.com/danielpalme/ReportGenerator/blob/dc395da3825e07700c1a16defd89e0c00434d2fd/src/ReportGenerator.Core/Generator.cs#L244

and probably the offending js is not added....!

c) Polyfill the remove method - but then the history chart is showed which fcc would then need to remove / account for d) remove all elements with class name historychart


Given that the custom report I am working on does not use report generator html building and will not suffer from this issue I would prefer a) over d/b).

tonyhallett avatar May 09 '22 13:05 tonyhallett

ok, removed (a) make things more complicated for me

viceice avatar May 09 '22 14:05 viceice

Remove the code that threw and removed any historychart elements. Should suffice.

tonyhallett avatar Jan 14 '24 19:01 tonyhallett