-
Notifications
You must be signed in to change notification settings - Fork 18
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
feat: add code coverage and junit reporting #491
Conversation
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
import { SourceCommand } from './sourceCommand'; | ||
import { DeployData, Stash } from './stash'; | ||
import { transformCoverageToApexCoverage, transformDeployTestsResultsToTestResult } from './coverageUtils'; | ||
// TODO: this function needs to be moved to a shared location | ||
import { toArray } from './formatters/resultFormatter'; |
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.
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.
I chose not to switch. SDR does not formally export that function. To me that means it is not meant to be consumed by others.
src/deployCommand.ts
Outdated
@@ -162,6 +181,85 @@ export abstract class DeployCommand extends SourceCommand { | |||
|
|||
return this.isAsync ? this.report(validatedDeployId) : this.poll(validatedDeployId); | |||
} | |||
|
|||
protected createRequestedReports(): void { |
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.
I like to name these kind of things maybeCreateRequestedReports
so that when you're reading it from the command, it's obvious that it might no-op.
coverageReport.generateReports(); | ||
} | ||
|
||
protected getCoverageFormattersOptions(formatters: string[] = []): CoverageReporterOptions { |
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.
if there are only certain strings that would be valid, you could use the typings here. Then, increateRequestedReports
, you can use this.getFlag<CoverageReportFormats[]>(this.flags.coverageformatters)
protected getCoverageFormattersOptions(formatters: string[] = []): CoverageReporterOptions { | |
protected getCoverageFormattersOptions(formatters: CoverageReportFormats[] = []): CoverageReporterOptions { |
src/deployCommand.ts
Outdated
const junitResults = jUnitReporter.format(testResult); | ||
|
||
const junitReportPath = path.join(this.outputDir, 'junit'); | ||
fs.mkdirSync(junitReportPath, { recursive: true }); |
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.
for this, and createCoverageReport
I'd prefer that methods with fs ops be async and use the async fs.
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.
I'll look into switch to async
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.
To make this async would require a larger refactor. If that is to be done, I suggest a separate work item or wait until these commands appear in sf.
Co-authored-by: Shane McLaughlin <[email protected]>
Co-authored-by: Benjamin <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Coverage report for
Sample classes:GeocodingService w/100% coverage:
PropertyController w/95% coverage:
*(Note line 26 & 31 ternary is not covered) |
|
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.
See my suggestions.
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Co-authored-by: Juliet Shackell <[email protected]>
Testing Levels for
|
What does this PR do?
Add code coverage and junit reporting for mdapi deploy, deploy report, source deploy and source deploy report commands
What issues does this PR fix or reference?
@AW-11025210@