-
Notifications
You must be signed in to change notification settings - Fork 149
Expand file tree
/
Copy pathcreateNewProject.test.ts
More file actions
94 lines (82 loc) · 4.85 KB
/
createNewProject.test.ts
File metadata and controls
94 lines (82 loc) · 4.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { runWithTestActionContext, TestInput } from '@microsoft/vscode-azext-dev';
import { FuncVersion, JavaBuildTool, ProjectLanguage, TemplateSource } from '../../extension.bundle';
import { addParallelSuite, ParallelTest } from '../addParallelSuite';
import { allTemplateSources, runForTemplateSource, shouldSkipVersion } from '../global.test';
import { createAndValidateProject, ICreateProjectTestOptions } from './createAndValidateProject';
import { getCSharpValidateOptions, getCustomValidateOptions, getDotnetScriptValidateOptions, getFSharpValidateOptions, getJavaScriptValidateOptions, getJavaValidateOptions, getPowerShellValidateOptions, getPythonValidateOptions, getTypeScriptValidateOptions } from './validateProject';
interface CreateProjectTestCase extends ICreateProjectTestOptions {
description?: string;
}
const testCases: CreateProjectTestCase[] = [
{ ...getCSharpValidateOptions('netcoreapp2.1', FuncVersion.v2) },
{ ...getCSharpValidateOptions('netcoreapp3.1', FuncVersion.v3), inputs: [/3/], description: 'netcoreapp3.1' },
{ ...getCSharpValidateOptions('net5.0', FuncVersion.v3), inputs: [/5/], description: 'net5.0 isolated v3' },
// https://github.com/Azure/azure-functions-tooling-feed/pull/289/files#r697703951
// { ...getCSharpValidateOptions('net5.0', FuncVersion.v4), inputs: [/5/], description: 'net5.0 isolated v4' },
{ ...getCSharpValidateOptions('net6.0', FuncVersion.v4), inputs: [/6/], description: 'net6.0' },
{ ...getCSharpValidateOptions('net6.0', FuncVersion.v4), inputs: [/6.*isolated/i], description: 'net6.0 isolated' },
{ ...getFSharpValidateOptions('netcoreapp2.1', FuncVersion.v2), isHiddenLanguage: true },
{ ...getFSharpValidateOptions('netcoreapp3.1', FuncVersion.v3), inputs: [/3/], isHiddenLanguage: true },
];
// Test cases that are the same for both v2 and v3
for (const version of [FuncVersion.v2, FuncVersion.v3, FuncVersion.v4]) {
testCases.push(
{ ...getJavaScriptValidateOptions(true /* hasPackageJson */, version) },
{ ...getTypeScriptValidateOptions(version) },
{ ...getPowerShellValidateOptions(version) },
{ ...getDotnetScriptValidateOptions(ProjectLanguage.CSharpScript, version), isHiddenLanguage: true },
{ ...getDotnetScriptValidateOptions(ProjectLanguage.FSharpScript, version), isHiddenLanguage: true },
);
testCases.push({
...getPythonValidateOptions('.venv', version),
inputs: ['python']
});
const appName: string = 'javaApp';
const javaBaseInputs: (TestInput | string | RegExp)[] = [TestInput.UseDefaultValue, TestInput.UseDefaultValue, TestInput.UseDefaultValue, TestInput.UseDefaultValue, appName];
if (version !== FuncVersion.v2) { // v2 doesn't support picking a java version
javaBaseInputs.unshift(/11/);
}
testCases.push({
...getJavaValidateOptions(appName, JavaBuildTool.gradle, version),
inputs: javaBaseInputs.concat(/Gradle/i, /skip for now/i),
description: JavaBuildTool.gradle
});
testCases.push({
...getJavaValidateOptions(appName, JavaBuildTool.maven, version),
inputs: javaBaseInputs.concat(/Maven/i),
description: JavaBuildTool.maven
});
}
testCases.push({ ...getCustomValidateOptions(FuncVersion.v3) });
const parallelTests: ParallelTest[] = [];
for (const testCase of testCases) {
for (const source of allTemplateSources) {
let title = `${testCase.language} ${testCase.version}`;
if (testCase.description) {
title += ` ${testCase.description}`;
}
title += ` (${source})`;
parallelTests.push({
title,
// Java template provider based on maven, which does not support gradle project for now
skip: shouldSkipVersion(testCase.version) || (testCase.description === JavaBuildTool.gradle && source !== TemplateSource.Backup),
// lots of errors like "The process cannot access the file because it is being used by another process" 😢
suppressParallel: [ProjectLanguage.FSharp, ProjectLanguage.CSharp, ProjectLanguage.Java].includes(testCase.language),
callback: async () => {
await runWithTestActionContext('createProject', async context => {
await runForTemplateSource(context, source, async () => {
await createAndValidateProject(context, testCase);
});
});
}
})
}
}
addParallelSuite(parallelTests, {
title: 'Create New Project',
timeoutMS: 2 * 60 * 1000
});