mirror of
https://github.com/actions/setup-dotnet.git
synced 2024-11-22 03:21:08 +07:00
Fix informational and debug messages
This commit is contained in:
parent
3cf3e230c1
commit
38b49fb717
@ -119,7 +119,7 @@ describe('installer tests', () => {
|
||||
await dotnetInstaller.installDotnet();
|
||||
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
`'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.`
|
||||
`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.`
|
||||
);
|
||||
});
|
||||
|
||||
@ -145,7 +145,7 @@ describe('installer tests', () => {
|
||||
await dotnetInstaller.installDotnet();
|
||||
|
||||
expect(warningSpy).toHaveBeenCalledWith(
|
||||
`'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.`
|
||||
`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.`
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -59,7 +59,7 @@ describe('setup-dotnet tests', () => {
|
||||
|
||||
const expectedDebugMessage =
|
||||
'No version found, trying to find version from global.json';
|
||||
const expectedInfoMessage = `global.json wasn't found in the root directory. No .NET version will be installed.`;
|
||||
const expectedInfoMessage = `A global.json wasn't found in the root directory. No .NET version will be installed.`;
|
||||
|
||||
await setup.run();
|
||||
|
||||
@ -73,7 +73,7 @@ describe('setup-dotnet tests', () => {
|
||||
inputs['dotnet-version'] = ['6.0'];
|
||||
inputs['dotnet-quality'] = 'fictitiousQuality';
|
||||
|
||||
const expectedErrorMessage = `${inputs['dotnet-quality']} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`;
|
||||
const expectedErrorMessage = `Value '${inputs['dotnet-quality']}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`;
|
||||
|
||||
await setup.run();
|
||||
expect(setFailedSpy).toHaveBeenCalledWith(expectedErrorMessage);
|
||||
@ -160,7 +160,7 @@ describe('setup-dotnet tests', () => {
|
||||
|
||||
it(`shouldn't call setOutput() if actions didn't install .NET`, async () => {
|
||||
inputs['dotnet-version'] = [];
|
||||
const warningMessage = `No .NET version was installed. The 'dotnet-version' output will not be set.`;
|
||||
const warningMessage = `The 'dotnet-version' output will not be set.`;
|
||||
|
||||
addToPathSpy.mockImplementation(() => {});
|
||||
|
||||
|
12
dist/index.js
vendored
12
dist/index.js
vendored
@ -255,7 +255,7 @@ class DotnetVersionResolver {
|
||||
resolveVersionInput() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
if (!semver_1.default.validRange(this.inputVersion) && !this.isLatestPatchSyntax()) {
|
||||
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`);
|
||||
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`);
|
||||
}
|
||||
if (semver_1.default.valid(this.inputVersion)) {
|
||||
this.createVersionArgument();
|
||||
@ -274,7 +274,7 @@ class DotnetVersionResolver {
|
||||
if (majorTag &&
|
||||
parseInt(majorTag) <
|
||||
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag) {
|
||||
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.`);
|
||||
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.`);
|
||||
}
|
||||
return majorTag ? true : false;
|
||||
}
|
||||
@ -371,7 +371,7 @@ class DotnetCoreInstaller {
|
||||
scriptArguments.push(option, this.quality);
|
||||
}
|
||||
else {
|
||||
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.`);
|
||||
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.`);
|
||||
}
|
||||
}
|
||||
installDotnet() {
|
||||
@ -556,13 +556,13 @@ function run() {
|
||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||
}
|
||||
else {
|
||||
core.info(`global.json wasn't found in the root directory. No .NET version will be installed.`);
|
||||
core.info(`A global.json wasn't found in the root directory. No .NET version will be installed.`);
|
||||
}
|
||||
}
|
||||
if (versions.length) {
|
||||
const quality = core.getInput('dotnet-quality');
|
||||
if (quality && !qualityOptions.includes(quality)) {
|
||||
throw new Error(`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`);
|
||||
throw new Error(`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`);
|
||||
}
|
||||
let dotnetInstaller;
|
||||
const uniqueVersions = new Set(versions);
|
||||
@ -605,7 +605,7 @@ function getVersionFromGlobalJson(globalJsonPath) {
|
||||
}
|
||||
function outputInstalledVersion(installedVersions, globalJsonFileInput) {
|
||||
if (!installedVersions.length) {
|
||||
core.info(`No .NET version was installed. The 'dotnet-version' output will not be set.`);
|
||||
core.info(`The 'dotnet-version' output will not be set.`);
|
||||
return;
|
||||
}
|
||||
if (installedVersions.includes(null)) {
|
||||
|
@ -33,7 +33,7 @@ export class DotnetVersionResolver {
|
||||
private async resolveVersionInput(): Promise<void> {
|
||||
if (!semver.validRange(this.inputVersion) && !this.isLatestPatchSyntax()) {
|
||||
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`
|
||||
`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`
|
||||
);
|
||||
}
|
||||
if (semver.valid(this.inputVersion)) {
|
||||
@ -57,7 +57,7 @@ export class DotnetVersionResolver {
|
||||
DotnetInstallerLimits.LatestPatchSyntaxMinimalMajorTag
|
||||
) {
|
||||
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.`
|
||||
`The 'dotnet-version' was supplied in invalid format: ${this.inputVersion}! The A.B.Cxx syntax is available since the .NET 5.0 release.`
|
||||
);
|
||||
}
|
||||
return majorTag ? true : false;
|
||||
@ -192,7 +192,7 @@ export class DotnetCoreInstaller {
|
||||
scriptArguments.push(option, this.quality);
|
||||
} else {
|
||||
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.`
|
||||
`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.`
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ export async function run() {
|
||||
versions.push(getVersionFromGlobalJson(globalJsonPath));
|
||||
} else {
|
||||
core.info(
|
||||
`global.json wasn't found in the root directory. No .NET version will be installed.`
|
||||
`A global.json wasn't found in the root directory. No .NET version will be installed.`
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ export async function run() {
|
||||
|
||||
if (quality && !qualityOptions.includes(quality)) {
|
||||
throw new Error(
|
||||
`${quality} is not a supported value for 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`
|
||||
`Value '${quality}' is not supported for the 'dotnet-quality' option. Supported values are: daily, signed, validated, preview, ga.`
|
||||
);
|
||||
}
|
||||
|
||||
@ -109,9 +109,7 @@ function outputInstalledVersion(
|
||||
globalJsonFileInput: string
|
||||
): void {
|
||||
if (!installedVersions.length) {
|
||||
core.info(
|
||||
`No .NET version was installed. The 'dotnet-version' output will not be set.`
|
||||
);
|
||||
core.info(`The 'dotnet-version' output will not be set.`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user