Skip to content

Commit

Permalink
feat: adding cobertura coverage reporter (projen#1504)
Browse files Browse the repository at this point in the history
GitLab CI [natively supports](https://docs.gitlab.com/ee/user/project/merge_requests/test_coverage_visualization.html#javascript-example) `cobertura` for coverage reporting

while the reporter can be added to a project with ` this.jest.config?.coverageReporters.push('cobertura')`, I think it's an easy addition to just add it to default reporters


---
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
  • Loading branch information
dontirun authored Jan 11, 2022
1 parent 8af8cfd commit a71ea69
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -13934,7 +13934,7 @@ Name | Type | Description
**coverageDirectory**?🔹 | <code>string</code> | The directory where Jest should output its coverage files.<br/>__*Default*__: "coverage"
**coveragePathIgnorePatterns**?🔹 | <code>Array<string></code> | An array of regexp pattern strings that are matched against all file paths before executing the test.<br/>__*Default*__: "/node_modules/"
**coverageProvider**?🔹 | <code>string</code> | Indicates which provider should be used to instrument code for coverage.<br/>__*Default*__: "babel"
**coverageReporters**?🔹 | <code>Array<string></code> | A list of reporter names that Jest uses when writing coverage reports.<br/>__*Default*__: ["json", "lcov", "text", "clover"]
**coverageReporters**?🔹 | <code>Array<string></code> | A list of reporter names that Jest uses when writing coverage reports.<br/>__*Default*__: ["json", "lcov", "text", "clover", "cobertura"]
**coverageThreshold**?🔹 | <code>[javascript.CoverageThreshold](#projen-javascript-coveragethreshold)</code> | Specify the global coverage thresholds.<br/>__*Default*__: undefined
**dependencyExtractor**?🔹 | <code>string</code> | This option allows the use of a custom dependency extractor.<br/>__*Default*__: undefined
**displayName**?🔹 | <code>any</code> | Allows for a label to be printed alongside a test while it is running.<br/>__*Default*__: undefined
Expand Down
3 changes: 2 additions & 1 deletion package.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/javascript/jest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export interface JestConfigOptions {

/**
* A list of reporter names that Jest uses when writing coverage reports. Any istanbul reporter can be used
* @default - ["json", "lcov", "text", "clover"]
* @default - ["json", "lcov", "text", "clover", "cobertura"]
*/
readonly coverageReporters?: string[];

Expand Down Expand Up @@ -598,6 +598,7 @@ export class Jest {
"json",
"lcov",
"clover",
"cobertura",
];
this.testMatch = this.jestConfig?.testMatch ?? [
"**/__tests__/**/*.[jt]s?(x)",
Expand Down
4 changes: 4 additions & 0 deletions test/__snapshots__/integ.test.ts.snap

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit a71ea69

Please sign in to comment.