Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

coverageInfo literal Object has a Problem ( Coverage 0/0 0%) at CenterOS 64bit #12

Open
wants to merge 2 commits into from

2 participants

@qpitlove

coverageInfo literal object key must have srcDir + fileName at CentOS 6.3 64Bit

FIX CODE LINE 367

AS IS
reading src/impressive.js
0 - 0
reading src/superb.js
0 - 0
0 - 0
Coverage in 0%

TO BE
reading src/impressive.js
2 - 0
reading src/superb.js
2 - 0
4 - 0
Coverage in 100%

qpitlove added some commits
@qpitlove qpitlove coverageInfo literal object key must have srcDir + fileName at
CentOS 6.3 64Bit 

AS IS 

reading src/impressive.js
0 - 0
reading src/superb.js
0 - 0
0 - 0
Coverage in 0%

TO BE
reading src/impressive.js
2 - 0
reading src/superb.js
2 - 0
4 - 0
Coverage in 100%
fd0ab5a
@qpitlove qpitlove coverageInfo literal object key must have srcDir + fileName at
CentOS 6.3 64Bit 

AS IS 

reading src/impressive.js
0 - 0
reading src/superb.js
0 - 0
0 - 0
Coverage in 0%

TO BE
reading src/impressive.js
2 - 0
reading src/superb.js
2 - 0
4 - 0
Coverage in 100%
0bcef1b
@afonsof
Owner

Hi,
I do not understand what you did.

Could you put these example files here?

@qpitlove

env

  • CentOS release 6.3 (Final) 64bit
  • Linux 2.6.32-358.23.2.el6.x86_64 #1 SMP Wed Oct 16 18:37:12 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux cap 2014-03-12 15-41-43-103
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 5, 2014
  1. @qpitlove

    coverageInfo literal object key must have srcDir + fileName at

    qpitlove authored
    CentOS 6.3 64Bit 
    
    AS IS 
    
    reading src/impressive.js
    0 - 0
    reading src/superb.js
    0 - 0
    0 - 0
    Coverage in 0%
    
    TO BE
    reading src/impressive.js
    2 - 0
    reading src/superb.js
    2 - 0
    4 - 0
    Coverage in 100%
  2. @qpitlove

    coverageInfo literal object key must have srcDir + fileName at

    qpitlove authored
    CentOS 6.3 64Bit 
    
    AS IS 
    
    reading src/impressive.js
    0 - 0
    reading src/superb.js
    0 - 0
    0 - 0
    Coverage in 0%
    
    TO BE
    reading src/impressive.js
    2 - 0
    reading src/superb.js
    2 - 0
    4 - 0
    Coverage in 100%
This page is out of date. Refresh to see the latest.
Showing with 49 additions and 47 deletions.
  1. +49 −47 tasks/qunit-cov.js
View
96 tasks/qunit-cov.js
@@ -60,7 +60,7 @@ module.exports = function(grunt)
}
// Handle methods passed from PhantomJS, including QUnit hooks.
- var phantomHandlers =
+ var phantomHandlers =
{
// QUnit hooks.
moduleStart: function(name)
@@ -98,12 +98,12 @@ module.exports = function(grunt)
grunt.log.error();
logFailedAssertions();
}
- else
+ else
{
grunt.log.write('F'.red);
}
}
- else
+ else
{
grunt.verbose.ok().or.write('.');
}
@@ -114,7 +114,7 @@ module.exports = function(grunt)
status.passed += passed;
status.total += total;
status.duration += duration;
-
+
if( coverage )
{
for(var key in coverage)
@@ -127,7 +127,7 @@ module.exports = function(grunt)
{
var globalCoverage = status.coverage[key];
var localCoverage = coverage[key];
-
+
for(var i = 0; i < localCoverage.length; i++)
{
if(localCoverage[i] !== null && globalCoverage[i] !== null)
@@ -137,16 +137,16 @@ module.exports = function(grunt)
}
}
}
- }
-
+ }
+
// Print assertion errors here, if verbose mode is disabled.
if (!grunt.option('verbose'))
{
- if (failed > 0)
+ if (failed > 0)
{
grunt.log.writeln();
logFailedAssertions();
- }
+ }
else
{
grunt.log.ok();
@@ -154,7 +154,7 @@ module.exports = function(grunt)
}
},
// Error handlers.
- done_fail: function(url)
+ done_fail: function(url)
{
grunt.verbose.write('Running PhantomJS...').or.write('...');
grunt.log.error();
@@ -188,7 +188,7 @@ module.exports = function(grunt)
baseDir = this.data.baseDir;
encoding = this.data.encoding ? this.data.encoding : "ISO-8859-1";
// Reset status.
-
+
if(fs.existsSync(outDir))
{
wrench.rmdirSyncRecursive(outDir);
@@ -204,7 +204,7 @@ module.exports = function(grunt)
fs.mkdirSync(outDir + '/in/' + baseDir + '/');
}
}
-
+
for(var i = 0; i < depDirs.length; i++)
{
var dir = depDirs[i];
@@ -212,9 +212,9 @@ module.exports = function(grunt)
wrench.mkdirSyncRecursive(outDir + '/in/' + dir);
wrench.copyDirSyncRecursive(dir, outDir + '/in/' + dir, {preserve: true});
}
-
+
grunt.log.write('Instrumenting folder \'' + srcDir + '\' to ' + outDir + '/in/' + srcDir + '...');
-
+
jscoverage(
{
code: 90,
@@ -226,7 +226,7 @@ module.exports = function(grunt)
done: function(err)
{
grunt.log.ok();
-
+
// Get files as URLs.
var urls = grunt.file.expand(outDir + '/in/' + testFiles);
@@ -292,7 +292,7 @@ module.exports = function(grunt)
cleanup();
next();
}
- else
+ else
{
// Update n so previously processed lines are ignored.
n = lines.length;
@@ -300,7 +300,7 @@ module.exports = function(grunt)
id = setTimeout(loopy, 100);
}
}());
-
+
// Launch PhantomJS.
phantomjs(
{
@@ -322,19 +322,19 @@ module.exports = function(grunt)
}
});
},
-
+
function(err)
{
// All tests have been run.
PrintCoverage(status.coverage, minimum, srcDir, outDir);
-
+
// Log results.
if (status.failed > 0)
{
grunt.warn(status.failed + '/' + status.total + ' assertions failed (' +
status.duration + 'ms)', Math.min(99, 90 + status.failed));
}
- else
+ else
{
grunt.verbose.writeln();
grunt.log.ok(status.total + ' assertions passed (' + status.duration + 'ms)');
@@ -354,24 +354,26 @@ module.exports = function(grunt)
{
var totalCovered = 0, totalUncovered = 0;
var coverageBase = grunt.file.read(getFile('qunit-cov/cov.tmpl')).toString();
-
- var filesCoverage = {};
-
+
+ var filesCoverage = {};
+
var files = grunt.file.expand(srcDir + '/**/*.js');
-
+
for(var i=0; i < files.length; i++)
{
var file = files[i];
- var relativeFile = file.substr(srcDir.length + 1);
-
+ //FIX coverageInfo literal Object Key is srcDir + fileName
+ //var relativeFile = file.substr(srcDir.length + 1);
+ var relativeFile = file;
+
grunt.log.writeln('reading ' + file);
-
+
var colorized = '';
var covered = 0;
var uncovered = 0;
var lineCoverage = coverageInfo[relativeFile];
var fileLines = grunt.file.read(file).split(/\r?\n/);
-
+
for (var idx=0; idx < fileLines.length; idx++)
{
var hitmiss = ' nottested';
@@ -402,37 +404,37 @@ module.exports = function(grunt)
colorized += '<div class="code' + hitmiss + '">' + htmlLine + '</div>\n';
filesCoverage[relativeFile] = { covered: covered, uncovered: uncovered };
}
-
+
grunt.log.writeln(covered + " - " + uncovered);
-
- colorized = coverageBase.replace('COLORIZED_LINE_HTML', colorized);
+
+ colorized = coverageBase.replace('COLORIZED_LINE_HTML', colorized);
var coverageOutputFile = outDir + '/out/' + relativeFile + '.html';
grunt.file.write(coverageOutputFile, colorized);
-
+
totalCovered += covered;
totalUncovered += uncovered;
-
+
if (grunt.option('verbose'))
{
- grunt.log.writeln('Coverage for ' + key + ' in ' + coverageOutputFile);
+ grunt.log.writeln('Coverage for ' + key + ' in ' + coverageOutputFile);
}
}
var totalPercent = totalCovered / (totalCovered + totalUncovered);
grunt.log.writeln(totalCovered + " - " + totalUncovered);
-
+
var html = '<h2>Total Coverage</h2><table>';
- html += printCoverageLine('', totalCovered, totalUncovered, true);
+ html += printCoverageLine('', totalCovered, totalUncovered, true);
html += '</table>';
-
+
html += '<h2>Detailed Coverage</h2><table>';
-
+
var covHtml = '';
var uncovHtml = '';
-
+
for(var key in filesCoverage)
{
var fileCoverage = filesCoverage[key];
-
+
if(fileCoverage.covered == 0 && fileCoverage.uncovered == 0)
{
uncovHtml+= printCoverageLine(key, fileCoverage.covered, fileCoverage.uncovered);
@@ -443,23 +445,23 @@ module.exports = function(grunt)
}
}
html += covHtml + '</table><table><h2>Uncovered Files</h2>' + uncovHtml + '</table>';
-
-
+
+
grunt.file.write(outDir + '/out/coverage.html', html);
-
-
+
+
grunt.log.writeln('Coverage in ' + parseInt(totalPercent*100, 10) + '%');
if( totalPercent < minimum)
{
- grunt.warn('Error: Coverage don\'t reach ' + (minimum*100) + '%');
+ grunt.warn('Error: Coverage don\'t reach ' + (minimum*100) + '%');
}
}
-
+
function printCoverageLine(file, covered, uncovered, doNotShowLink)
{
var percent = parseInt(100 * covered / (covered + uncovered), 10);
-
+
var link = file;
if(!doNotShowLink)
{
Something went wrong with that request. Please try again.