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

Function run

Extension/test/common/selectTests.ts:76–120  ·  view source on GitHub ↗
(testsRoot: string, cb: (error: any, failures?: number) => void)

Source from the content-addressed store, hash-verified

74}
75
76export function run (testsRoot: string, cb: (error: any, failures?: number) => void): void {
77/**
78 * This code runs in the extension host process, and not in the launch (main.ts) process.
79 */
80 let location = '';
81
82 // scan through the $args to find the --scenario=...
83 process.argv.slice(2).find(arg => arg.startsWith('--scenario=') && (location = arg.substring('--scenario='.length)));
84
85 void getTestInfo(location, env.SCENARIO).then(async (testInfo) => {
86 if (!testInfo) {
87 console.error(`The Scenario folder must be specified either by '--scenario=...' or an environment variable 'SCENARIO=...'`);
88 process.exit(1);
89 }
90 const { name} = testInfo;
91
92 void glob(`${$root}/dist/test/scenarios/${name}/tests/**/**.test.js`).then((files) => {
93
94 try {
95 if (!files.length) {
96 throw new Error(`Unable to find unit tests for ${name} at '${$root}/dist/test/scenarios/${name}/tests/**/**.test.js'`);
97 }
98 const mocha = new Mocha({
99 ui: 'tdd',
100 timeout: 500000,
101 require: ['source-map-support/register'],
102 color: true
103 });
104
105 // Add files to the test suite
106 files.forEach(f => mocha.addFile(resolve(testsRoot, f)));
107
108 console.log('\n\n=============================================\n Test Output\n\n');
109 // Run the mocha test
110 mocha.run((failures: any) => {
111 cb(null, failures);
112 console.log('\n\n=============================================\n\n');
113 });
114 } catch (err) {
115 console.error(err);
116 cb(err);
117 }
118 });
119 });
120}

Callers

nothing calls this directly

Calls 4

getTestInfoFunction · 0.85
errorMethod · 0.80
thenMethod · 0.45
forEachMethod · 0.45

Tested by

no test coverage detected