Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/test/e2e/workspace-e2e.stest.ts
13388 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { ssuite, stest } from '../base/stest';
7
import { validate } from '../base/validate';
8
import { discoverScenarios } from './scenarioLoader';
9
import { generateScenarioTestRunner, shouldSkip } from './scenarioTest';
10
11
ssuite({ title: 'workspace', subtitle: 'e2e', location: 'panel' }, (inputPath) => {
12
// No default cases checked in at the moment
13
if (!inputPath) {
14
return;
15
}
16
17
const scenariosFolder = inputPath;
18
const scenarios = discoverScenarios(scenariosFolder);
19
for (const scenario of scenarios) {
20
const fileName = scenario[0].name;
21
const testName = fileName.substring(0, fileName.indexOf('.'));
22
stest.optional(shouldSkip.bind(undefined, scenario), { description: testName },
23
generateScenarioTestRunner(
24
scenario,
25
async (accessor, question, answer) => {
26
if (scenario[0].json.keywords !== undefined) {
27
const err = validate(answer, scenario[0].json.keywords);
28
if (err) {
29
return { success: false, errorMessage: err };
30
}
31
32
return { success: true, errorMessage: answer };
33
}
34
35
return { success: true, errorMessage: 'No requirements set for test.' };
36
}));
37
}
38
});
39
40