feat: Add 'preLaunchTask' to test configuration (#1327)

Signed-off-by: Sheng Chen <sheche@microsoft.com>
This commit is contained in:
Sheng Chen 2021-11-02 16:13:16 +08:00 коммит произвёл GitHub
Родитель 003f493a4d
Коммит d1feb56af6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 27 добавлений и 1 удалений

Просмотреть файл

@ -209,6 +209,11 @@
},
"description": "%configuration.java.test.config.sourcePaths.description%",
"default": []
},
"preLaunchTask": {
"type": "string",
"description": "%configuration.java.test.config.preLaunchTask.description%",
"default": ""
}
},
"description": "%configuration.java.test.config.description%",
@ -248,6 +253,11 @@
"description": "%configuration.java.test.config.env.description%",
"default": {}
},
"envFile": {
"type": "string",
"description": "%configuration.java.test.config.envFile.description%",
"default": "${workspaceFolder}/.env"
},
"sourcePaths": {
"type": "array",
"items": {
@ -255,6 +265,11 @@
},
"description": "%configuration.java.test.config.sourcePaths.description%",
"default": []
},
"preLaunchTask": {
"type": "string",
"description": "%configuration.java.test.config.preLaunchTask.description%",
"default": ""
}
}
},

Просмотреть файл

@ -15,6 +15,7 @@
"configuration.java.test.config.env.description": "Specify the extra environment variables when running the tests",
"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.",
"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.noProjectWithProjectManagerInstalled": "No folder opened in Visual Studio Code. You can [open a Java project](command:_java.project.open), or create a new Java project by clicking the button below.\n[Create Java Project](command:java.project.create)",
"contributes.viewsWelcome.noProjectWithOutProjectManagerInstalled": "No folder opened in Visual Studio Code."

Просмотреть файл

@ -15,6 +15,7 @@
"configuration.java.test.config.env.description": "启动应用程序时自定义的环境变量",
"configuration.java.test.config.envFile.description": "环境变量文件绝对路径",
"configuration.java.test.config.sourcePaths.description": "设定调试测试用例时的源代码路径",
"configuration.java.test.config.preLaunchTask.description": "在 tasks.json在工作空间的.vscode文件夹中中某个任务的名称。该任务会在启动测试之前被执行",
"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.noProjectWithProjectManagerInstalled": "当前没有已打开的文件夹,您可以[打开一个 Java 项目](command:_java.project.open),或点击下方按钮创建一个新的 Java 项目。\n[创建 Java 项目](command:java.project.create)",
"contributes.viewsWelcome.noProjectWithOutProjectManagerInstalled": "当前没有已打开的文件夹。"

Просмотреть файл

@ -45,6 +45,11 @@ export interface IExecutionConfig {
* @since 0.22.4
*/
sourcePaths?: string[];
/**
* The label of a task specified in tasks.json.
* @since 0.33.0
*/
preLaunchTask?: string;
}
export function getBuiltinConfig(): IExecutionConfig {

Просмотреть файл

@ -42,6 +42,7 @@ export async function resolveLaunchConfigurationForRunner(runner: BaseRunner, te
envFile: config?.envFile,
noDebug: !testContext.isDebug,
sourcePaths: config?.sourcePaths,
preLaunchTask: config?.preLaunchTask,
};
}
@ -60,6 +61,7 @@ export async function resolveLaunchConfigurationForRunner(runner: BaseRunner, te
envFile: config?.envFile,
noDebug: !testContext.isDebug,
sourcePaths: config?.sourcePaths,
preLaunchTask: config?.preLaunchTask,
};
}

Просмотреть файл

@ -48,10 +48,12 @@ suite('JUnit Runner Analyzer Tests', () => {
envFile: "${workspaceFolder}/.env",
sourcePaths: [
"/a/b/c.jar"
]
],
preLaunchTask: "test",
});
assert.strictEqual(configuration.env.test, "test");
assert.strictEqual(configuration.envFile, "${workspaceFolder}/.env");
assert.strictEqual(configuration.sourcePaths?.[0], "/a/b/c.jar");
assert.strictEqual(configuration.preLaunchTask, "test");
});
});