Skip to content

Commit b60650f

Browse files
committed
Fixes for Copilot suggestions
1 parent 862497d commit b60650f

2 files changed

Lines changed: 13 additions & 9 deletions

File tree

Extension/test/common/selectTests.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,17 @@ export async function getTestInfo(...scenarioOptions: (string | undefined)[]) {
7474
}
7575

7676
/**
77-
* When running tests on GitHub, this function determines if the tests should be skipped based on
78-
* whether the binary version copied for tests is compatible with the minimum required version.
79-
* The minimum required binary version is defined in the `binaryCompat.json` file and changes when
80-
* there are breaking changes in the communication protocol or messages.
77+
* When running tests after using `yarn install-and-copy-binaries-for-test`, this function determines
78+
* if the tests should be skipped based on whether the binary version copied for tests is compatible
79+
* with the minimum required version. The minimum required binary version is defined in the
80+
* `minBinaryVersion.json` file and changes when there are breaking changes in the communication
81+
* protocol or messages.
8182
*
82-
* When running locally, the function will always return false since you're expected to have the
83-
* correct binaries available.
83+
* When running locally, the function is expected to always return false since you're more likely to
84+
* have the correct binaries available. If you ever ran `yarn install-and-copy-binaries-for-test` locally
85+
* and the binaries are too old, this function will return true and skip the tests. The remedy is to
86+
* delete the `bin/binaryVersion.json` file and/or re-run `yarn install-and-copy-binaries-for-test` to
87+
* get the latest binaries.
8488
* @returns A promise that resolves to a boolean indicating whether the tests should be skipped.
8589
*/
8690
async function shouldSkipTests(): Promise<boolean> {
@@ -99,7 +103,7 @@ async function shouldSkipTests(): Promise<boolean> {
99103
}
100104
if (tooOld) {
101105
console.warn(`\nBinary-dependent tests SKIPPED: installed binary version ${binaryVersion.version} is below the required minimum ${binaryCompat.minBinaryVersion}.`);
102-
console.warn(`Tests will re-enable automatically once binaries >= ${binaryCompat.minBinaryVersion} are installed.\n`);
106+
console.warn(`Tests will re-enable automatically once binaries >= ${binaryCompat.minBinaryVersion} are installed or 'bin/binaryVersion.json' is removed.\n`);
103107
return true;
104108
}
105109
}
@@ -129,7 +133,7 @@ export function run(testsRoot: string, cb: (error: any, failures?: number) => vo
129133
return;
130134
}
131135

132-
const files = await glob(`${$root}/dist/test/scenarios/${name}/tests/**/**.test.js`);
136+
const files = await glob(`${$root}/dist/test/scenarios/${name}/tests/**/**.test.js`).catch(returns.none);
133137
try {
134138
if (!files.length) {
135139
throw new Error(`Unable to find unit tests for ${name} at '${$root}/dist/test/scenarios/${name}/tests/**/**.test.js'`);

Extension/test/scenarios/RunWithoutDebugging/tests/runWithoutDebugging.terminals.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ suite('Run Without Debugging Terminal and Arguments Test', function (this: Mocha
108108
'two words',
109109
path.join(workspacePath, 'input folder', 'three words.txt')
110110
];
111-
const skipExternalConsole = process.env.SCENARIO_ARGS?.includes('skipExternalConsole');
111+
const skipExternalConsole = process.env.SCENARIO_ARGS?.split(',').includes('skipExternalConsole');
112112

113113
suiteSetup(async function (): Promise<void> {
114114
const extension: vscode.Extension<any> = vscode.extensions.getExtension('ms-vscode.cpptools') || assert.fail('Extension not found');

0 commit comments

Comments
 (0)