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
fix cobertura report #571
Merged
bcoe
merged 5 commits into
istanbuljs:master
from
bitcloud:develop/fix-cobertura-report
Oct 13, 2021
Merged
fix cobertura report #571
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
ea86ea5
chore(istanbul-reports): update fixtures
bitcloud e2718b5
chore(istanbul-reports): testcase for cobertura
bitcloud 70ca81e
fix(istanbul-reports): fix cobertura no packages
bitcloud f18e556
chore(istanbul-reports): add fixture for packages
bitcloud 52305e8
chore(istanbul-reports): make tests platform aware
bitcloud File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
'use strict'; | ||
/* globals describe, it, beforeEach, before, after */ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const isWindows = require('is-windows'); | ||
const FileWriter = require('istanbul-lib-report/lib/file-writer'); | ||
const istanbulLibReport = require('istanbul-lib-report'); | ||
const istanbulLibCoverage = require('istanbul-lib-coverage'); | ||
const CoberturaReport = require('../../lib/cobertura/index'); | ||
|
||
require('chai').should(); | ||
|
||
describe('CoberturaReport', () => { | ||
before(() => { | ||
FileWriter.startCapture(); | ||
}); | ||
after(() => { | ||
FileWriter.stopCapture(); | ||
}); | ||
beforeEach(() => { | ||
FileWriter.resetOutput(); | ||
}); | ||
|
||
function createTest(file) { | ||
const fixture = require(path.resolve( | ||
__dirname, | ||
'../fixtures/specs/' + file | ||
)); | ||
it(fixture.title, function() { | ||
if (isWindows()) { | ||
// appveyor does not render console color. | ||
return this.skip(); | ||
} | ||
const context = istanbulLibReport.createContext({ | ||
dir: './', | ||
coverageMap: istanbulLibCoverage.createCoverageMap(fixture.map) | ||
}); | ||
const tree = context.getTree('pkg'); | ||
const report = new CoberturaReport({ | ||
file: '-', | ||
timestamp: '123456789', | ||
...fixture.opts | ||
}); | ||
tree.visit(report, context); | ||
const output = FileWriter.getOutput(); | ||
output.should.equal(fixture.coberturaCoverageData); | ||
}); | ||
} | ||
|
||
fs.readdirSync(path.resolve(__dirname, '../fixtures/specs')).forEach( | ||
file => { | ||
if (file.indexOf('.json') !== -1) { | ||
createTest(file); | ||
} | ||
} | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thank you for adding a test for cobertura 🎉