-
Notifications
You must be signed in to change notification settings - Fork 149
Show quickpicks if there are multiple runtime matches for targetFramework
#4165
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
Changes from 6 commits
c163011
6a34002
284e066
9257f30
260e01d
e34414b
463244c
0c7d002
192b95a
c0cd710
9758da7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* eslint-disable no-restricted-imports */ | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you need this still? |
||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (c) Microsoft Corporation. All rights reserved. | ||
| * Licensed under the MIT License. See License.md in the project root for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| import { type TestUserInput } from "@microsoft/vscode-azext-dev"; | ||
| import { type Uri, type WorkspaceFolder } from "vscode"; | ||
| import { type FuncVersion, type TemplateSchemaVersion } from "../extension.bundle"; | ||
| import { type OpenBehavior } from "../src/commands/createNewProject/IProjectWizardContext"; | ||
| import { type ProjectLanguage } from "../src/constants"; | ||
| import { type cliFeedUtils } from "../src/utils/cliFeedUtils"; | ||
|
|
||
| export interface MockIProjectWizardContext { | ||
| projectPath: string; | ||
| workspacePath: string; | ||
| workspaceFolder: WorkspaceFolder | undefined; | ||
|
|
||
| language?: ProjectLanguage; | ||
| languageModel?: number; | ||
| languageFilter?: RegExp; | ||
|
|
||
| version: FuncVersion; | ||
| templateSchemaVersion?: TemplateSchemaVersion; | ||
| projectTemplateKey: string | undefined; | ||
| workerRuntime?: cliFeedUtils.IWorkerRuntime; | ||
| openBehavior?: OpenBehavior; | ||
|
|
||
| generateFromOpenAPI?: boolean; | ||
| openApiSpecificationFile?: Uri[]; | ||
|
|
||
| targetFramework?: string | string[]; | ||
|
|
||
| containerizedProject?: boolean; | ||
|
|
||
| telemetry: { | ||
| properties: { [key: string]: string | undefined; } | ||
| measurements: { [key: string]: number | undefined; } | ||
| }; | ||
| errorHandling: { | ||
| issueProperties: {} | ||
| }; | ||
| valuesToMask: string[]; | ||
| ui: TestUserInput; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,11 +7,11 @@ import { runWithInputs } from '@microsoft/vscode-azext-dev'; | |
| import { type apiUtils } from "@microsoft/vscode-azext-utils"; | ||
| import * as path from 'path'; | ||
| import { extensions, type Extension } from "vscode"; | ||
| import { ProjectLanguage, extensionId, nonNullValue, registerOnActionStartHandler } from '../extension.bundle'; | ||
| import { FuncVersion, ProjectLanguage, extensionId, nonNullValue, registerOnActionStartHandler } from '../extension.bundle'; | ||
| // eslint-disable-next-line no-restricted-imports | ||
| import { type AzureFunctionsExtensionApi } from '../src/vscode-azurefunctions.api'; | ||
| import { getTestWorkspaceFolder, testFolderPath } from './global.test'; | ||
| import { getJavaScriptValidateOptions, validateProject, type IValidateProjectOptions } from './project/validateProject'; | ||
| import { getCSharpValidateOptions, getJavaScriptValidateOptions, validateProject, type IValidateProjectOptions } from './project/validateProject'; | ||
|
|
||
| suite(`AzureFunctionsExtensionApi`, () => { | ||
| let api: AzureFunctionsExtensionApi; | ||
|
|
@@ -73,4 +73,46 @@ suite(`AzureFunctionsExtensionApi`, () => { | |
| ); | ||
| await validateProject(folderPath, validateOptions); | ||
| }); | ||
|
|
||
| test('createFunction dotnet with targetFramework', async () => { | ||
| const functionName: string = 'endpoint1'; | ||
| const language: string = ProjectLanguage.CSharp; | ||
| const workspaceFolder = getTestWorkspaceFolder(); | ||
| const projectSubpath = 'api'; | ||
| const folderPath: string = path.join(workspaceFolder, projectSubpath); | ||
|
|
||
| await runWithInputs('api.createFunction', [language, /6/i, 'Company.Function', 'Anonymous'], registerOnActionStartHandler, async () => { | ||
| await api.createFunction({ | ||
| folderPath, | ||
| functionName, | ||
| templateId: 'HttpTrigger', | ||
| languageFilter: /^C\#$/i, | ||
| functionSettings: { authLevel: 'anonymous' }, | ||
| targetFramework: ['net8.0', 'net7.0', 'net6.0'] | ||
|
alexweininger marked this conversation as resolved.
|
||
| }); | ||
| }); | ||
|
|
||
| const validateOptions: IValidateProjectOptions = getCSharpValidateOptions('net6.0', FuncVersion.v4); | ||
| await validateProject(folderPath, validateOptions); | ||
| }); | ||
|
|
||
| // When passing in a language version that is not in the target framework the last two inputs should not be prompted if they are this test will fail | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test is ensuring that target framework property is properly used to filter the picks from all available framework versions. From this comment, it's not clear to me:
I think a better comment would start like: // Intentionally pass a version (8) that hasn't been specified in |
||
| test('createFunction with language not in targetFramework', async () => { | ||
| const functionName: string = 'endpoint1'; | ||
| const language: string = ProjectLanguage.CSharp; | ||
| const workspaceFolder = getTestWorkspaceFolder(); | ||
| const projectSubpath = 'api'; | ||
| const folderPath: string = path.join(workspaceFolder, projectSubpath); | ||
|
|
||
| await runWithInputs('api.createFunction', [language, /8/i], registerOnActionStartHandler, async () => { | ||
| await api.createFunction({ | ||
| folderPath, | ||
| functionName, | ||
| templateId: 'HttpTrigger', | ||
| languageFilter: /^C\#$/i, | ||
| functionSettings: { authLevel: 'anonymous' }, | ||
| targetFramework: ['net7.0', 'net6.0'] | ||
| }) | ||
| }); | ||
| }); | ||
| }); | ||
Uh oh!
There was an error while loading. Please reload this page.