nikseras / js-test-driver

Automatically exported from code.google.com/p/js-test-driver
0 stars 0 forks source link

Extra '.' in base path breaks genhtml coverage reports #367

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Generate a coverage report .dat (with --output)
2. Generage html of the report with genhtml
3. Drill down into any file in the report from the top level

What is the expected output? What do you see instead?

Expected a copy of the file with covered lines highlighted. Instead the page is 
unstyled with broken image links.

What version of the product are you using? On what operating system?

1.3.4b, OS X Lion

Please provide any additional information below.

The bug is that the paths in the lcov dat file are produced like so:
/home/brian/jstd/./src/swfobject.js
(note the '.'). When genhtml tries to calculate the path to the parent 
directory, in order to include css/images, it simply counts the number of 
slashes required. This extra './' breaks that logic and causes genhtml to 
generate paths to the css with an extra '../' (two dots). More detail about the 
genhtml issue can be found here:
http://sourceforge.net/tracker/?func=detail&aid=3520158&group_id=3382&atid=10338
2

Clearly this is a bug in genhtml but it's the recommended tool for working with 
the coverage output of jstd. The reason why jstd is generating the extra '.' is 
this code in DefaultConfigurationSource:

  public File getParentFile() {
    return new File(".").getAbsoluteFile();
  }

The correct paths will be generated with:
  public File getParentFile() {
    return new File("").getAbsoluteFile();
  }
... however this is probably not the correct answer (see 
http://stackoverflow.com/questions/5883808/new-file-vs-new-file-feature-or-bug) 
and the canonical file is the one that's required. Alternatively, simply fixing 
paths written out to the .dat file to replace '/./' with '/' would fix it.

Original issue reported on code.google.com by brian.ew...@gmail.com on 23 Apr 2012 at 11:38