Skip to content

Commit 38b49fb

Browse files
author
IvanZosimov
committed
Fix informational and debug messages
1 parent 3cf3e23 commit 38b49fb

File tree

5 files changed

+17
-19
lines changed

5 files changed

+17
-19
lines changed

__tests__/installer.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('installer tests', () => {
119119
await dotnetInstaller.installDotnet();
120120

121121
expect(warningSpy).toHaveBeenCalledWith(
122-
`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${inputVersion}. 'dotnet-quality' input is ignored.`
122+
`The 'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${inputVersion}. 'dotnet-quality' input is ignored.`
123123
);
124124
});
125125

@@ -145,7 +145,7 @@ describe('installer tests', () => {
145145
await dotnetInstaller.installDotnet();
146146

147147
expect(warningSpy).toHaveBeenCalledWith(
148-
`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A and A.x formats where the major tag is higher than 5. You specified: ${inputVersion}. 'dotnet-quality' input is ignored.`
148+
`The 'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${inputVersion}. 'dotnet-quality' input is ignored.`
149149
);
150150
});
151151

__tests__/setup-dotnet.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ describe('setup-dotnet tests', () => {
5959

6060
const expectedDebugMessage =
6161
'No version found, trying to find version from global.json';
62-
const expectedInfoMessage = `global.json wasn't found in the root directory. No .NET version will be installed.`;
62+
const expectedInfoMessage = `A global.json wasn't found in the root directory. No .NET version will be installed.`;
6363

6464
await setup.run();
6565

@@ -73,7 +73,7 @@ describe('setup-dotnet tests', () => {
7373
inputs['dotnet-version'] = ['6.0'];
7474
inputs['dotnet-quality'] = 'fictitiousQuality';
7575

76-
const expectedErrorMessage = `${inputs['dotnet-quality']} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`;
76+
const expectedErrorMessage = `Value '${inputs['dotnet-quality']}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`;
7777

7878
await setup.run();
7979
expect(setFailedSpy).toHaveBeenCalledWith(expectedErrorMessage);
@@ -160,7 +160,7 @@ describe('setup-dotnet tests', () => {
160160

161161
it(`shouldn't call setOutput() if actions didn't install .NET`, async () => {
162162
inputs['dotnet-version'] = [];
163-
const warningMessage = `No .NET version was installed. The 'dotnet-version' output will not be set.`;
163+
const warningMessage = `The 'dotnet-version' output will not be set.`;
164164

165165
addToPathSpy.mockImplementation(() => {});
166166

dist/index.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ class DotnetVersionResolver {
255255
resolveVersionInput() {
256256
return __awaiter(this, void 0, void 0, function* () {
257257
if (!semver_1.default.validRange(this.inputVersion) && !this.isLatestPatchSyntax()) {
258-
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x, A.B.Cxx`);
258+
throw new Error(`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x, A.B.Cxx`);
259259
}
260260
if (semver_1.default.valid(this.inputVersion)) {
261261
this.createVersionArgument();
@@ -274,7 +274,7 @@ class DotnetVersionResolver {
274274
if (majorTag &&
275275
parseInt(majorTag) <
276276
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag) {
277-
throw new Error(`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`);
277+
throw new Error(`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`);
278278
}
279279
return majorTag ? true : false;
280280
}
@@ -371,7 +371,7 @@ class DotnetCoreInstaller {
371371
scriptArguments.push(option, this.quality);
372372
}
373373
else {
374-
core.warning(`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`);
374+
core.warning(`The 'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`);
375375
}
376376
}
377377
installDotnet() {
@@ -556,13 +556,13 @@ function run() {
556556
versions.push(getVersionFromGlobalJson(globalJsonPath));
557557
}
558558
else {
559-
core.info(`global.json wasn't found in the root directory. No .NET version will be installed.`);
559+
core.info(`A global.json wasn't found in the root directory. No .NET version will be installed.`);
560560
}
561561
}
562562
if (versions.length) {
563563
const quality = core.getInput('dotnet-quality');
564564
if (quality && !qualityOptions.includes(quality)) {
565-
throw new Error(`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`);
565+
throw new Error(`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`);
566566
}
567567
let dotnetInstaller;
568568
const uniqueVersions = new Set(versions);
@@ -605,7 +605,7 @@ function getVersionFromGlobalJson(globalJsonPath) {
605605
}
606606
function outputInstalledVersion(installedVersions, globalJsonFileInput) {
607607
if (!installedVersions.length) {
608-
core.info(`No .NET version was installed. The 'dotnet-version' output will not be set.`);
608+
core.info(`The 'dotnet-version' output will not be set.`);
609609
return;
610610
}
611611
if (installedVersions.includes(null)) {

src/installer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class DotnetVersionResolver {
3333
private async resolveVersionInput(): Promise<void> {
3434
if (!semver.validRange(this.inputVersion) && !this.isLatestPatchSyntax()) {
3535
throw new Error(
36-
`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x, A.B.Cxx`
36+
`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! Supported syntax: A.B.C, A.B, A.B.x, A, A.x, A.B.Cxx`
3737
);
3838
}
3939
if (semver.valid(this.inputVersion)) {
@@ -57,7 +57,7 @@ export class DotnetVersionResolver {
5757
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag
5858
) {
5959
throw new Error(
60-
`'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`
60+
`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`
6161
);
6262
}
6363
return majorTag ? true : false;
@@ -192,7 +192,7 @@ export class DotnetCoreInstaller {
192192
scriptArguments.push(option, this.quality);
193193
} else {
194194
core.warning(
195-
`'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`
195+
`The 'dotnet-quality' input can be used only with .NET SDK version in A.B, A.B.x, A, A.x and A.B.Cxx formats where the major tag is higher than 5. You specified: ${this.version}. 'dotnet-quality' input is ignored.`
196196
);
197197
}
198198
}

src/setup-dotnet.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function run() {
4848
versions.push(getVersionFromGlobalJson(globalJsonPath));
4949
} else {
5050
core.info(
51-
`global.json wasn't found in the root directory. No .NET version will be installed.`
51+
`A global.json wasn't found in the root directory. No .NET version will be installed.`
5252
);
5353
}
5454
}
@@ -58,7 +58,7 @@ export async function run() {
5858

5959
if (quality && !qualityOptions.includes(quality)) {
6060
throw new Error(
61-
`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`
61+
`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`
6262
);
6363
}
6464

@@ -109,9 +109,7 @@ function outputInstalledVersion(
109109
globalJsonFileInput: string
110110
): void {
111111
if (!installedVersions.length) {
112-
core.info(
113-
`No .NET version was installed. The 'dotnet-version' output will not be set.`
114-
);
112+
core.info(`The 'dotnet-version' output will not be set.`);
115113
return;
116114
}
117115

0 commit comments

Comments
 (0)