fix: Add 'testKind' to the test configuration (#1479)
* fix: Add 'testKind' to the test configuration Signed-off-by: Sheng Chen <sheche@microsoft.com>
This commit is contained in:
Родитель
b49a9b192d
Коммит
8e25a6151e
|
@ -144,29 +144,29 @@
|
|||
}
|
||||
},
|
||||
"@microsoft/1ds-core-js": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-3.2.3.tgz",
|
||||
"integrity": "sha512-796A8fd90oUKDRO7UXUT9BwZ3G+a9XzJj5v012FcCN/2qRhEsIV3x/0wkx2S08T4FiQEUPkB2uoYHpEjEneM7g==",
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/1ds-core-js/-/1ds-core-js-3.2.6.tgz",
|
||||
"integrity": "sha512-6OpppYCEA+rXjcs2w0KnWji3Y6ZDx0wykY7ZL3QF68NS323C45GHSpkDpVRT/lDU6Xbau/PvQm2zTYAzLcperA==",
|
||||
"requires": {
|
||||
"@microsoft/applicationinsights-core-js": "2.8.4",
|
||||
"@microsoft/applicationinsights-core-js": "2.8.6",
|
||||
"@microsoft/applicationinsights-shims": "^2.0.1",
|
||||
"@microsoft/dynamicproto-js": "^1.1.6"
|
||||
}
|
||||
},
|
||||
"@microsoft/1ds-post-js": {
|
||||
"version": "3.2.3",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-3.2.3.tgz",
|
||||
"integrity": "sha512-tcGJQXXr2LYoBbIXPoUVe1KCF3OtBsuKDFL7BXfmNtuSGtWF0yejm6H83DrR8/cUIGMRMUP9lqNlqFGwDYiwAQ==",
|
||||
"version": "3.2.6",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/1ds-post-js/-/1ds-post-js-3.2.6.tgz",
|
||||
"integrity": "sha512-Zdyl3FU6kU/a7TlVVSTBZg+hSECTT65iI99FsjMOx88HudyVyk9M/0lVbA+FVXvGaxzmtBW6Lw0qRHYp4tBMSA==",
|
||||
"requires": {
|
||||
"@microsoft/1ds-core-js": "3.2.3",
|
||||
"@microsoft/1ds-core-js": "3.2.6",
|
||||
"@microsoft/applicationinsights-shims": "^2.0.1",
|
||||
"@microsoft/dynamicproto-js": "^1.1.6"
|
||||
}
|
||||
},
|
||||
"@microsoft/applicationinsights-core-js": {
|
||||
"version": "2.8.4",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-2.8.4.tgz",
|
||||
"integrity": "sha512-FoA0FNOsFbJnLyTyQlYs6+HR7HMEa6nAOE6WOm9WVejBHMHQ/Bdb+hfVFi6slxwCimr/ner90jchi4/sIYdnyQ==",
|
||||
"version": "2.8.6",
|
||||
"resolved": "https://registry.npmjs.org/@microsoft/applicationinsights-core-js/-/applicationinsights-core-js-2.8.6.tgz",
|
||||
"integrity": "sha512-rL+ceda1Y6HaHBe1vIbNT/f5JGuHiD5Ydq+DoAfu56o13wyJu4sao3QKaabgaIM59pPO+3BMeGsK8NNUGYaT3w==",
|
||||
"requires": {
|
||||
"@microsoft/applicationinsights-shims": "2.0.1",
|
||||
"@microsoft/dynamicproto-js": "^1.1.6"
|
||||
|
@ -1040,7 +1040,7 @@
|
|||
"fs.realpath": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==",
|
||||
"integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=",
|
||||
"dev": true
|
||||
},
|
||||
"fsevents": {
|
||||
|
@ -1204,7 +1204,7 @@
|
|||
"inflight": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
|
||||
"integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==",
|
||||
"integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"once": "^1.3.0",
|
||||
|
@ -1304,7 +1304,7 @@
|
|||
"isobject": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
||||
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
|
||||
"integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
|
||||
"dev": true
|
||||
},
|
||||
"jest-worker": {
|
||||
|
@ -1599,7 +1599,7 @@
|
|||
"once": {
|
||||
"version": "1.4.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
|
||||
"integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==",
|
||||
"integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"wrappy": "1"
|
||||
|
@ -1638,7 +1638,7 @@
|
|||
"path-is-absolute": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
|
||||
"integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==",
|
||||
"integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=",
|
||||
"dev": true
|
||||
},
|
||||
"path-key": {
|
||||
|
@ -2243,9 +2243,9 @@
|
|||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
},
|
||||
"vscode-extension-telemetry-wrapper": {
|
||||
"version": "0.13.1",
|
||||
"resolved": "https://registry.npmjs.org/vscode-extension-telemetry-wrapper/-/vscode-extension-telemetry-wrapper-0.13.1.tgz",
|
||||
"integrity": "sha512-EZH0rNqQXhl6vyoM+z2FGrlBVGNHBS4bRjw4wkCNce1IageaFhCJpElWdumQrxQRM2cBQRNkbUAe8d3LYrpMSQ==",
|
||||
"version": "0.13.2",
|
||||
"resolved": "https://registry.npmjs.org/vscode-extension-telemetry-wrapper/-/vscode-extension-telemetry-wrapper-0.13.2.tgz",
|
||||
"integrity": "sha512-Ika7ws4VlFZuK4hmP7rUYsMe91evjCaRsWbEzxijr2um6S97LKhQxave1yub7XWowErLTk3wZKPZS6aodaYjhw==",
|
||||
"requires": {
|
||||
"@vscode/extension-telemetry": "^0.6.2",
|
||||
"uuid": "^8.3.2"
|
||||
|
|
18
package.json
18
package.json
|
@ -285,6 +285,15 @@
|
|||
"description": "%configuration.java.test.config.preLaunchTask.description%",
|
||||
"default": ""
|
||||
},
|
||||
"testKind": {
|
||||
"type": "string",
|
||||
"markdownDescription": "%configuration.java.test.config.testKind.description%",
|
||||
"enum": [
|
||||
"junit",
|
||||
"testng"
|
||||
],
|
||||
"default": "junit"
|
||||
},
|
||||
"filters": {
|
||||
"type": "object",
|
||||
"description": "%configuration.java.test.config.filters.description%",
|
||||
|
@ -404,6 +413,15 @@
|
|||
"description": "%configuration.java.test.config.preLaunchTask.description%",
|
||||
"default": ""
|
||||
},
|
||||
"testKind": {
|
||||
"type": "string",
|
||||
"markdownDescription": "%configuration.java.test.config.testKind.description%",
|
||||
"enum": [
|
||||
"junit",
|
||||
"testng"
|
||||
],
|
||||
"default": "junit"
|
||||
},
|
||||
"filters": {
|
||||
"type": "object",
|
||||
"description": "%configuration.java.test.config.filters.description%",
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
"configuration.java.test.config.envFile.description": "Specify the absolute path to a file containing environment variable definitions.",
|
||||
"configuration.java.test.config.sourcePaths.description": "Specify extra source paths when debugging the tests.",
|
||||
"configuration.java.test.config.preLaunchTask.description": "Specify the label of a task specified in tasks.json (in the workspace's .vscode folder). The task will be launched before the start of testing.",
|
||||
"configuration.java.test.config.testKind.description": "Specify the targeting test framework for this test configuration. Supported values are `junit`, `testng`.",
|
||||
"configuration.java.test.config.filters.description": "Specify the test filters.",
|
||||
"configuration.java.test.config.filters.tags.description": "Specify the tags to be included or excluded. \n\nTags having `!` as the prefix will be **excluded**. \n\nNote: It **only** takes effect on JUnit 5 tests.",
|
||||
"configuration.java.test.config.filters.tags.description": "Specify the tags to be included or excluded. \n\nTags having `!` as the prefix will be **excluded**. \n\nNote: This setting **only** takes effect when `testKind` is set to `junit`.",
|
||||
"contributes.viewsWelcome.inLightWeightMode": "No test cases are listed because the Java Language Server is currently running in [LightWeight Mode](https://aka.ms/vscode-java-lightweight). To show test cases, click on the button to switch to Standard Mode.\n[Switch to Standard Mode](command:java.server.mode.switch?%5B%22Standard%22,true%5D)",
|
||||
"contributes.viewsWelcome.enableTests": "Click below button to configure a test framework for your project.\n[Enable Java Tests](command:_java.test.enableTests)"
|
||||
}
|
||||
|
|
|
@ -27,8 +27,9 @@
|
|||
"configuration.java.test.config.envFile.description": "环境变量文件绝对路径。",
|
||||
"configuration.java.test.config.sourcePaths.description": "设定调试测试用例时的源代码路径。",
|
||||
"configuration.java.test.config.preLaunchTask.description": "在 tasks.json(在工作空间的.vscode文件夹中)中某个任务的名称。该任务会在启动测试之前被执行。",
|
||||
"configuration.java.test.config.testKind.description": "指定该测试配置项的目标测试框架。可选的值有 `junit`,`testng`。",
|
||||
"configuration.java.test.config.filters.description": "测试过滤配置项。",
|
||||
"configuration.java.test.config.filters.tags.description": "指定要包含或排除的标记。\n\n带有`!`前缀的标记将会被**排除**。 \n\n注意:该选项**仅**会对 JUnit 5 生效。",
|
||||
"configuration.java.test.config.filters.tags.description": "指定要包含或排除的标记。\n\n带有`!`前缀的标记将会被**排除**。 \n\n注意:该选项**仅**会在 `testKind` 设置为 `junit` 时生效。",
|
||||
"contributes.viewsWelcome.inLightWeightMode": "由于 Java 语言服务正运行在 [LightWeight 模式](https://aka.ms/vscode-java-lightweight)下,因此测试用例将不会展示在该视图中。如果您需要展示测试用例,可以点击下方按钮将 Java 语言服务切换至 Standard 模式。\n[切换至 Standard 模式](command:java.server.mode.switch?%5B%22Standard%22,true%5D)",
|
||||
"contributes.viewsWelcome.enableTests": "点击下方按钮为你的项目添加一个测试框架\n[启用 Java 测试](command:_java.test.enableTests)"
|
||||
}
|
||||
|
|
|
@ -71,6 +71,12 @@ export interface IExecutionConfig {
|
|||
*/
|
||||
preLaunchTask?: string;
|
||||
|
||||
/**
|
||||
* the test framework kind of this test configuration.
|
||||
* @since 0.37.0
|
||||
*/
|
||||
testKind?: string;
|
||||
|
||||
/**
|
||||
* The configurations for test filters.
|
||||
* @since 0.37.0
|
||||
|
@ -78,7 +84,8 @@ export interface IExecutionConfig {
|
|||
filters?: {
|
||||
/**
|
||||
* The test tags which will be included or excluded when running tests.
|
||||
* This field will only take effect on JUnit 5 tests.
|
||||
* This field will only take effect on JUnit 5 tests and user needs to
|
||||
* explicitly set `testKind` to `junit`.
|
||||
* @since 0.37.0
|
||||
*/
|
||||
tags?: string[]
|
||||
|
|
|
@ -144,7 +144,11 @@ async function resolveJUnitLaunchArguments(projectName: string, testLevel: TestL
|
|||
* Parse the tags from the test configuration.
|
||||
*/
|
||||
function parseTags(config: IExecutionConfig | undefined): string[] {
|
||||
const tags: string[] = []
|
||||
const tags: string[] = [];
|
||||
if (config?.testKind !== 'junit') {
|
||||
return tags;
|
||||
}
|
||||
|
||||
if (config?.filters?.tags) {
|
||||
for (let tag of config.filters.tags) {
|
||||
tag = tag.trim();
|
||||
|
|
|
@ -82,6 +82,7 @@ suite('LaunchUtils Tests', () => {
|
|||
test('test parseTags()', () => {
|
||||
const { parseTags } = exportedForTesting;
|
||||
const config = {
|
||||
testKind: 'junit',
|
||||
filters: {
|
||||
tags: [
|
||||
"foo",
|
||||
|
@ -104,4 +105,16 @@ suite('LaunchUtils Tests', () => {
|
|||
]
|
||||
assert.ok(tags.length === expected.length && tags.every((tag, idx) => tag === expected[idx]));
|
||||
});
|
||||
|
||||
test('test parseTags() when testKind is not set', () => {
|
||||
const { parseTags } = exportedForTesting;
|
||||
const config = {
|
||||
filters: {
|
||||
tags: [
|
||||
"foo",
|
||||
]
|
||||
}
|
||||
};
|
||||
assert.ok(parseTags(config).length === 0);
|
||||
});
|
||||
});
|
||||
|
|
Загрузка…
Ссылка в новой задаче