diff --git a/packages/ado-extension/src/task-config/ado-task-config.spec.ts b/packages/ado-extension/src/task-config/ado-task-config.spec.ts index 8537d9547..27f4a0632 100644 --- a/packages/ado-extension/src/task-config/ado-task-config.spec.ts +++ b/packages/ado-extension/src/task-config/ado-task-config.spec.ts @@ -30,19 +30,20 @@ describe(ADOTaskConfig, () => { } it.each` - inputOption | inputValue | expectedValue | getInputFunc - ${'repoToken'} | ${'token'} | ${'token'} | ${() => taskConfig.getToken()} - ${'scanUrlRelativePath'} | ${'path'} | ${'path'} | ${() => taskConfig.getScanUrlRelativePath()} - ${'chromePath'} | ${'./chromePath'} | ${getPlatformAgnosticPath(__dirname + '/chromePath')} | ${() => taskConfig.getChromePath()} - ${'inputFile'} | ${'./inputFile'} | ${getPlatformAgnosticPath(__dirname + '/inputFile')} | ${() => taskConfig.getInputFile()} - ${'outputDir'} | ${'./outputDir'} | ${getPlatformAgnosticPath(__dirname + '/outputDir')} | ${() => taskConfig.getReportOutDir()} - ${'siteDir'} | ${'path'} | ${'path'} | ${() => taskConfig.getSiteDir()} - ${'url'} | ${'url'} | ${'url'} | ${() => taskConfig.getUrl()} - ${'discoveryPatterns'} | ${'abc'} | ${'abc'} | ${() => taskConfig.getDiscoveryPatterns()} - ${'inputUrls'} | ${'abc'} | ${'abc'} | ${() => taskConfig.getInputUrls()} - ${'maxUrls'} | ${'20'} | ${20} | ${() => taskConfig.getMaxUrls()} - ${'scanTimeout'} | ${'100000'} | ${100000} | ${() => taskConfig.getScanTimeout()} - ${'localhostPort'} | ${'8080'} | ${8080} | ${() => taskConfig.getLocalhostPort()} + inputOption | inputValue | expectedValue | getInputFunc + ${'repoToken'} | ${'token'} | ${'token'} | ${() => taskConfig.getToken()} + ${'scanUrlRelativePath'} | ${'path'} | ${'path'} | ${() => taskConfig.getScanUrlRelativePath()} + ${'chromePath'} | ${'./chromePath'} | ${getPlatformAgnosticPath(__dirname + '/chromePath')} | ${() => taskConfig.getChromePath()} + ${'inputFile'} | ${'./inputFile'} | ${getPlatformAgnosticPath(__dirname + '/inputFile')} | ${() => taskConfig.getInputFile()} + ${'outputDir'} | ${'./outputDir'} | ${getPlatformAgnosticPath(__dirname + '/outputDir')} | ${() => taskConfig.getReportOutDir()} + ${'siteDir'} | ${'path'} | ${'path'} | ${() => taskConfig.getSiteDir()} + ${'url'} | ${'url'} | ${'url'} | ${() => taskConfig.getUrl()} + ${'discoveryPatterns'} | ${'abc'} | ${'abc'} | ${() => taskConfig.getDiscoveryPatterns()} + ${'inputUrls'} | ${'abc'} | ${'abc'} | ${() => taskConfig.getInputUrls()} + ${'maxUrls'} | ${'20'} | ${20} | ${() => taskConfig.getMaxUrls()} + ${'scanTimeout'} | ${'100000'} | ${100000} | ${() => taskConfig.getScanTimeout()} + ${'localhostPort'} | ${'8080'} | ${8080} | ${() => taskConfig.getLocalhostPort()} + ${'repoServiceConnectionName'} | ${'testName'} | ${'testName'} | ${() => taskConfig.getRepoServiceConnectionName()} `( `input value '$inputValue' returned as '$expectedValue' for '$inputOption' parameter`, ({ inputOption, getInputFunc, inputValue, expectedValue }) => { @@ -55,6 +56,21 @@ describe(ADOTaskConfig, () => { }, ); + it.each` + inputOption | inputValue | expectedValue | getInputFunc + ${'failOnAccessibilityError'} | ${true} | ${true} | ${() => taskConfig.getFailOnAccessibilityError()} + `( + `bool input value '$inputValue' returned as '$expectedValue' for '$inputOption' parameter`, + ({ inputOption, getInputFunc, inputValue, expectedValue }) => { + adoTaskMock + .setup((am) => am.getBoolInput(inputOption)) + .returns(() => inputValue) + .verifiable(Times.once()); + const retrievedOption = getInputFunc(); + expect(retrievedOption).toStrictEqual(expectedValue); + }, + ); + it('should use environment value when chrome-path input is undefined', () => { const chromePath = 'some path'; processStub = { diff --git a/packages/ado-extension/src/task-config/ado-task-config.ts b/packages/ado-extension/src/task-config/ado-task-config.ts index 86034370d..a1e088618 100644 --- a/packages/ado-extension/src/task-config/ado-task-config.ts +++ b/packages/ado-extension/src/task-config/ado-task-config.ts @@ -84,6 +84,14 @@ export class ADOTaskConfig extends TaskConfig { return parseInt(this.processObj.env.BUILD_BUILDID, 10); } + public getRepoServiceConnectionName(): string { + return this.adoTaskObj.getInput('repoServiceConnectionName'); + } + + public getFailOnAccessibilityError(): boolean { + return this.adoTaskObj.getBoolInput('failOnAccessibilityError'); + } + private getAbsolutePath(path: string): string { if (isEmpty(path)) { return undefined; diff --git a/packages/ado-extension/task.json b/packages/ado-extension/task.json index e6406cf2f..734702b75 100644 --- a/packages/ado-extension/task.json +++ b/packages/ado-extension/task.json @@ -109,6 +109,14 @@ "defaultValue": "90000", "required": false, "helpMarkDown": "The maximum timeout in milliseconds for the scan (excluding dependency setup)." + }, + { + "name": "failOnAccessibilityError", + "type": "boolean", + "label": "Fail on Accessibility Error", + "defaultValue": false, + "required": false, + "helpMarkDown": "Fail the task if there are accessibility issues." } ], "execution": {