Skip to content

Fix for: Cannot read property 'classes' of undefined #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AlexBeauchemin
Copy link

This fix allow to handle different xml structures
In my case, the cobertura-coverage.xml had a different structure that made the lib crash:

<?xml version="1.0" ?>
<!DOCTYPE coverage SYSTEM "http://cobertura.sourceforge.net/xml/coverage-04.dtd">
<coverage lines-valid="33" lines-covered="29" line-rate="0.8787999999999999" branches-valid="10" branches-covered="8" branch-rate="0.8" timestamp="1523546158798" complexity="0" version="0.1">
  <sources>
    <source>/Users/xxx/xxx/app</source>
  </sources>
  <packages>
    <class name="app.js" filename="dist/app.js" line-rate="0.9" branch-rate="0.8">
    ...
    </class>
  </packages>

Using
"istanbul": "v1.1.0-alpha.1"
"remap-istanbul": "^0.9.5"
"mocha": "^3.5.3"

@AlexBeauchemin AlexBeauchemin changed the title Fix for Cannot read property 'classes' of undefined Fix for: Cannot read property 'classes' of undefined Apr 12, 2018
@coveralls
Copy link

Coverage Status

Coverage decreased (-3.6%) to 88.618% when pulling 1d05ef8 on AlexBeauchemin:master into f0621f0 on intuit:master.

@coveralls
Copy link

coveralls commented Apr 12, 2018

Coverage Status

Coverage decreased (-0.4%) to 91.87% when pulling e4315ff on AlexBeauchemin:master into f0621f0 on intuit:master.

if (err) {
console.log(err);
}
console.log("Deleted the badge file " + coverageBadgePath);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'console' is not defined.


fs.unlink(coverageBadgePath, function(err) {
if (err) {
console.log(err);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'console' is not defined.

expect(err).to.be.null;
expect(badgeStatus).to.be.an("object");

console.log(badgeStatus);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'console' is not defined.

fs.stat(coverageBadgePath, function gettingStats(err, stats) {
expect(err).to.be.null;
expect(stats).to.be.an("object");
expect(stats.isFile()).to.be.true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.


// Verify that the badge file was successfully created
fs.stat(coverageBadgePath, function gettingStats(err, stats) {
expect(err).to.be.null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.

console.log(badgeStatus);

var fileWithExtension = opts.badgeFileName + ".svg";
var coverageBadgePath = path.normalize(path.resolve(destinationDir, fileWithExtension));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.


// Load the badge for the report
badger(opts, function parsingResults(err, badgeStatus) {
expect(err).to.be.null;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Expected an assignment or function call and instead saw an expression.

var opts = {
badgeFileName: "coverage-multiple-without-classes",
destinationDir: destinationDir,
istanbulReportFile: path.resolve(__dirname, "fixture", "istanbul-report-multiple-packages-without-classes.xml")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.
'__dirname' is not defined.

@@ -94,6 +94,47 @@ describe("istanbul-cobertura-badger", function() {
});
});

it("should compute overall coverage over packages without classes and create the badge", function(done) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line is too long.

@sureshappana
Copy link

sureshappana commented Aug 29, 2018

Still this issue exists. Waiting for the PR to be merged.
Issue regarding generation of different format by Istanbul was logged here: istanbuljs/istanbuljs#66

@AlexBeauchemin
Copy link
Author

This is ready to be merged but I think the maintainers are gone 😞

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants