-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
ci: produce jest xml reports only in azure pipelines #10160
Conversation
In gatsbyjs#10128, we added test report tasks to Azure pipelines. Unfortunately, this adds some additional overhead and coverage type stuff in _local_ development that we probably don't want. This PR addresses this issue, and conditionally detects whether running in CI. If running in CI (e.g. Azure Pipelines, Circle, etc.) it will add the additional coverage reporter and coverage functionality. Note: this is currently blocked by watson/ci-info#22
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.
Looks good. Left a comment!
jest.config.js
Outdated
@@ -31,7 +31,7 @@ module.exports = { | |||
moduleNameMapper: { | |||
"^highlight.js$": `<rootDir>/node_modules/highlight.js/lib/index.js`, | |||
}, | |||
collectCoverage: true, | |||
collectCoverage: !!process.env.GENERATE_JEST_REPORT, |
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.
Nit, but could we hoist this up to something like
const useCoverage = !!process.env.GENERATE_JEST_REPORT
// use elsewhere
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.
👍 done (at least I hope I did what you meant ;) )
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.
exactly :)
* test: do not report coverage unless in CI In gatsbyjs#10128, we added test report tasks to Azure pipelines. Unfortunately, this adds some additional overhead and coverage type stuff in _local_ development that we probably don't want. This PR addresses this issue, and conditionally detects whether running in CI. If running in CI (e.g. Azure Pipelines, Circle, etc.) it will add the additional coverage reporter and coverage functionality. Note: this is currently blocked by watson/ci-info#22 * add GENERATE_JEST_REPORT env var and use it with azure pipelines * use var to hold normalized (boolean) val from env var
temporary alternative to #10140 (until
ci-info
supports azure pipelines)/cc @DSchau