Skip to content
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: nullish template literal #1093

Merged
merged 2 commits into from
Jul 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/commands/project/deploy/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export default class DeployMetadata extends SfCommand<DeployResultJson> {
this.log(
messages.getMessage('apiVersionMsgDetailed', [
action,
// technically manifestVersion can be undefined, but only on raw mdapi deployments.
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
flags['metadata-dir'] ? '<version specified in manifest>' : `v${apiData.manifestVersion}`,
username,
apiData.apiVersion,
Expand Down
2 changes: 2 additions & 0 deletions src/commands/project/deploy/validate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ export default class DeployMetadataValidate extends SfCommand<DeployResultJson>
this.log(
deployMessages.getMessage('apiVersionMsgDetailed', [
'Validating Deployment of',
// technically manifestVersion can be undefined, but only on raw mdapi deployments.
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
flags['metadata-dir'] ? '<version specified in manifest>' : `v${apiData.manifestVersion}`,
username,
apiData.apiVersion,
Expand Down
5 changes: 4 additions & 1 deletion src/formatters/deleteResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,10 @@ export class DeleteResultFormatter extends TestResultsFormatter implements Forma
if (deployMessages.length >= successes.length) {
// if there's additional successes in the API response, find the success and add it to the output
deployMessages.map((deployMessage) => {
if (!fileResponseSuccesses.has(`${deployMessage.componentType}#${deployMessage.fullName}`)) {
if (
deployMessage.componentType &&
!fileResponseSuccesses.has(`${deployMessage.componentType}#${deployMessage.fullName}`)
) {
successes.push(
Object.assign(deployMessage, {
type: deployMessage.componentType,
Expand Down
4 changes: 2 additions & 2 deletions src/formatters/deployResultFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
// only generate reports if test results are presented
if (this.coverageOptions.reportFormats?.length) {
ux.log(
`Code Coverage formats, [${this.flags['coverage-formatters']?.join(', ')}], written to ${join(
`Code Coverage formats, [${(this.flags['coverage-formatters'] ?? []).join(', ')}], written to ${join(
this.resultsDir,
'coverage'
)}/`
Expand Down Expand Up @@ -325,7 +325,7 @@ export class DeployResultFormatter extends TestResultsFormatter implements Forma
problemType: f.problemType,
fullName: f.fullName,
error: f.error,
loc: f.lineNumber ? `${f.lineNumber}:${f.columnNumber}` : '',
loc: f.lineNumber ? `${f.lineNumber}:${f.columnNumber ?? ''}` : '',
})),
columns,
options
Expand Down
2 changes: 1 addition & 1 deletion src/formatters/testResultsFormatter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const displayVerboseTestFailures = (response: MetadataApiDeployStatus): void =>
const failures = ensureArray(response.details.runTestResult?.failures).sort(testResultSort);
const failureCount = response.details.runTestResult?.numFailures;
ux.log();
ux.log(error(`Test Failures [${failureCount}]`));
ux.log(error(`Test Failures [${failureCount ?? 0}]`));
for (const test of failures) {
const testName = ansis.underline(`${test.name}.${test.methodName}`);
ux.log(`• ${testName}`);
Expand Down
1 change: 1 addition & 0 deletions src/hooks/diagnostics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ const getMaxApiVersion = async (aggregator: ConfigAggregator, aliasOrUsername: s
// Comparing 55.0 with 55.0 would return false.
// Comparing 55.0 with 56.0 would return true.
const diff = (version1: string | undefined, version2: string | undefined): boolean => {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
getLogger().debug(`Comparing API versions: [${version1},${version2}]`);
return !!version1?.length && !!version2?.length && version1 !== version2;
};