MCPcopy Index your code
hub / github.com/microsoft/vscode-cpptools / getScenarioInfo

Function getScenarioInfo

Extension/test/common/selectTests.ts:22–62  ·  view source on GitHub ↗
(val: string)

Source from the content-addressed store, hash-verified

20const scenariosFolder = resolve($root, 'test', 'scenarios');
21
22async function getScenarioInfo(val: string) {
23
24 // is it a name relative to the tests/scenarios folder?
25 const folder = await filepath.isFolder(val, scenariosFolder);
26
27 if (folder) {
28 let name = basename(folder);
29 if (name === 'assets') {
30 name = basename(dirname(folder));
31 }
32
33 if ((await readdir(`${$root}/dist/test/scenarios/${name}/tests`).catch(returns.empty)).length === 0) {
34 // no tests in this scenario have been compiled
35 return undefined;
36 }
37 const assets = await filepath.isFolder('assets', folder) ?? folder;
38
39 return {
40 name,
41 assets,
42 workspace: (await glob(`${folder}/**/*.code-workspace`))[0] || assets
43 };
44 }
45
46 const file = await filepath.isFile(val, scenariosFolder);
47 if (file) {
48 const assets = dirname(dirname(file));
49 const name = basename(assets);
50 if ((await readdir(`${$root}/dist/test/scenarios/${name}/tests`)).length === 0) {
51 // no tests in this scenario have been compiled
52 return undefined;
53 }
54
55 return {
56 name,
57 assets,
58 workspace: file
59 };
60 }
61 return undefined;
62}
63
64export async function getTestInfo(...scenarioOptions: (string | undefined)[]) {
65 for (const each of scenarioOptions) {

Callers 1

getTestInfoFunction · 0.85

Calls 3

isFolderMethod · 0.80
catchMethod · 0.45
isFileMethod · 0.45

Tested by

no test coverage detected