forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelper.ts
More file actions
21 lines (19 loc) · 1 KB
/
helper.ts
File metadata and controls
21 lines (19 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
import * as assert from 'assert';
import { sep } from 'path';
import { IS_WINDOWS } from '../../client/common/platform/constants';
import { Tests } from '../../client/unittests/common/types';
export function lookForTestFile(tests: Tests, testFile: string) {
let found: boolean;
// Perform case insensitive search on windows.
if (IS_WINDOWS) {
// In the mock output, we'd have paths separated using '/' (but on windows, path separators are '\')
const testFileToSearch = testFile.split(sep).join('/');
found = tests.testFiles.some(t => (t.name.toUpperCase() === testFile.toUpperCase() || t.name.toUpperCase() === testFileToSearch.toUpperCase()) &&
t.nameToRun.toUpperCase() === t.name.toUpperCase());
} else {
found = tests.testFiles.some(t => t.name === testFile && t.nameToRun === t.name);
}
assert.equal(found, true, `Test File not found '${testFile}'`);
}