Skip to content

Commit 9d9acdf

Browse files
Filter out undefined locations in the tests.
1 parent 3359a2e commit 9d9acdf

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

src/client/pythonEnvironments/base/locatorUtils.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ function getSearchLocationFilters(query: PythonLocatorQuery): ((u: Uri) => boole
6363
if (query.searchLocations === undefined) {
6464
return undefined;
6565
}
66-
const candidates: Uri[] = query.searchLocations.roots.filter((u) => !!u);
67-
if (candidates.length === 0) {
66+
if (query.searchLocations.roots.length === 0) {
6867
return undefined;
6968
}
70-
return candidates.map((loc) => getURIFilter(loc, {
69+
return query.searchLocations.roots.map((loc) => getURIFilter(loc, {
7170
checkParent: true,
7271
checkExact: true,
7372
}));

src/test/pythonEnvironments/base/locatorUtils.unit.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ suite('Python envs locator utils - getQueryFilter', () => {
232232
test('match all (including non-searched)', () => {
233233
const expected = envs;
234234
const searchLocations = {
235-
roots: expected.map((env) => env.searchLocation!),
235+
roots: expected.map((e) => e.searchLocation!).filter((e) => !!e),
236236
includeNonRooted: true,
237237
};
238238
const query: PythonLocatorQuery = { searchLocations };

0 commit comments

Comments
 (0)