Added ability to run single VSCode functional test. (#1562)

- In VSCode only (F5) you are now prompted with a test file filter that will be applied to the entire list of functional tests.
- This does not impact command line runs.

dotnet/aspnetcore#17045
This commit is contained in:
N. Taylor Mullen 2020-02-11 12:40:48 -08:00 коммит произвёл GitHub
Родитель 0daa1809d1
Коммит b51b3c92c1
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 20 добавлений и 3 удалений

7
.vscode/launch.json поставляемый
Просмотреть файл

@ -62,15 +62,18 @@
"preLaunchTask": "CompileGrammarTests"
},
{
"name": "Run Functional Tests",
"name": "Run Functional Test",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"args": [
"${workspaceFolder}/src/Razor/test/testapps/",
"--extensionDevelopmentPath=${workspaceFolder}/src/Razor/src/Microsoft.AspNetCore.Razor.VSCode.Extension",
"--extensionTestsPath=${workspaceFolder}/src/Razor/test/Microsoft.AspNetCore.Razor.VSCode.FunctionalTest/dist/index",
"--extensionTestsPath=${workspaceFolder}/src/Razor/test/Microsoft.AspNetCore.Razor.VSCode.FunctionalTest/dist/index"
],
"env": {
"runSingleTest": "true"
},
"outFiles": [
"${workspaceFolder}/src/Razor/test/Microsoft.AspNetCore.Razor.VSCode.FunctionalTest/dist/**/*.js",
],

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

@ -26,8 +26,22 @@ export async function run(): Promise<void> {
await vscode.commands.executeCommand('extension.configureRazorDevMode');
}
let testFilter: string | undefined;
if (process.env.runSingleTest === 'true') {
testFilter = await vscode.window.showInputBox({
prompt: 'Test file filter',
placeHolder: '**.test.js',
});
}
if (!testFilter) {
testFilter = '**.test.js';
} else if (!testFilter.endsWith('.test.js')) {
testFilter += '**.test.js';
}
return new Promise((c, e) => {
glob('**/**.test.js', { cwd: testsRoot }, (err, files) => {
glob(`**/${testFilter}`, { cwd: testsRoot }, (err, files) => {
if (err) {
return e(err);
}