mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-12-13 22:39:32 -06:00
Platform independent wildcard file include ordering (#22393)
* Resolve config wildcards result order in a platform independent manner * Accept affected user test baseline * Per reccomendation, just change matchFiles * Add test asserting the same order on differing case sensitive platforms
This commit is contained in:
parent
45eaf42006
commit
88ba1ef2de
@ -2539,7 +2539,6 @@ namespace ts {
|
||||
path = normalizePath(path);
|
||||
currentDirectory = normalizePath(currentDirectory);
|
||||
|
||||
const comparer = useCaseSensitiveFileNames ? compareStringsCaseSensitive : compareStringsCaseInsensitive;
|
||||
const patterns = getFileMatcherPatterns(path, excludes, includes, useCaseSensitiveFileNames, currentDirectory);
|
||||
|
||||
const regexFlag = useCaseSensitiveFileNames ? "" : "i";
|
||||
@ -2560,7 +2559,7 @@ namespace ts {
|
||||
function visitDirectory(path: string, absolutePath: string, depth: number | undefined) {
|
||||
const { files, directories } = getFileSystemEntries(path);
|
||||
|
||||
for (const current of sort(files, comparer)) {
|
||||
for (const current of sort(files, compareStringsCaseSensitive)) {
|
||||
const name = combinePaths(path, current);
|
||||
const absoluteName = combinePaths(absolutePath, current);
|
||||
if (extensions && !fileExtensionIsOneOf(name, extensions)) continue;
|
||||
@ -2583,7 +2582,7 @@ namespace ts {
|
||||
}
|
||||
}
|
||||
|
||||
for (const current of sort(directories, comparer)) {
|
||||
for (const current of sort(directories, compareStringsCaseSensitive)) {
|
||||
const name = combinePaths(path, current);
|
||||
const absoluteName = combinePaths(absolutePath, current);
|
||||
if ((!includeDirectoryRegex || includeDirectoryRegex.test(absoluteName)) &&
|
||||
|
||||
@ -91,6 +91,18 @@ namespace ts {
|
||||
"c:/dev/g.min.js/.g/g.ts"
|
||||
]);
|
||||
|
||||
const caseInsensitiveOrderingDiffersWithCaseHost = new Utils.MockParseConfigHost(caseInsensitiveBasePath, /*useCaseSensitiveFileNames*/ false, [
|
||||
"c:/dev/xylophone.ts",
|
||||
"c:/dev/Yosemite.ts",
|
||||
"c:/dev/zebra.ts",
|
||||
]);
|
||||
|
||||
const caseSensitiveOrderingDiffersWithCaseHost = new Utils.MockParseConfigHost(caseSensitiveBasePath, /*useCaseSensitiveFileNames*/ true, [
|
||||
"/dev/xylophone.ts",
|
||||
"/dev/Yosemite.ts",
|
||||
"/dev/zebra.ts",
|
||||
]);
|
||||
|
||||
function assertParsed(actual: ParsedCommandLine, expected: ParsedCommandLine): void {
|
||||
assert.deepEqual(actual.fileNames, expected.fileNames);
|
||||
assert.deepEqual(actual.wildcardDirectories, expected.wildcardDirectories);
|
||||
@ -1482,5 +1494,25 @@ namespace ts {
|
||||
validateMatches(expected, json, caseSensitiveHost, caseSensitiveBasePath);
|
||||
});
|
||||
});
|
||||
|
||||
it("can include files in the same order on multiple platforms", () => {
|
||||
function getExpected(basePath: string): ParsedCommandLine {
|
||||
return {
|
||||
options: {},
|
||||
errors: [],
|
||||
fileNames: [
|
||||
`${basePath}Yosemite.ts`, // capital always comes before lowercase letters
|
||||
`${basePath}xylophone.ts`,
|
||||
`${basePath}zebra.ts`
|
||||
],
|
||||
wildcardDirectories: {
|
||||
[basePath.slice(0, basePath.length - 1)]: WatchDirectoryFlags.Recursive
|
||||
},
|
||||
};
|
||||
}
|
||||
const json = {};
|
||||
validateMatches(getExpected(caseSensitiveBasePath), json, caseSensitiveOrderingDiffersWithCaseHost, caseSensitiveBasePath);
|
||||
validateMatches(getExpected(caseInsensitiveBasePath), json, caseInsensitiveOrderingDiffersWithCaseHost, caseInsensitiveBasePath);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@ -13074,9 +13074,9 @@ node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1057,39):
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1108,15): error TS2339: Property 'valuesArray' does not exist on type 'Set<any>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1116,15): error TS2339: Property 'firstValue' does not exist on type 'Set<any>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1126,15): error TS2339: Property 'addAll' does not exist on type 'Set<any>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1127,17): error TS2495: Type 'T[] | Iterable<T>' is not an array type or a string type.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1127,17): error TS2495: Type 'Iterable<T> | T[]' is not an array type or a string type.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1136,15): error TS2339: Property 'containsAll' does not exist on type 'Set<any>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1137,17): error TS2495: Type 'T[] | Iterable<T>' is not an array type or a string type.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1137,17): error TS2495: Type 'Iterable<T> | T[]' is not an array type or a string type.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1148,15): error TS2339: Property 'remove' does not exist on type 'Map<any, any>'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1155,21): error TS2304: Cannot find name 'VALUE'.
|
||||
node_modules/chrome-devtools-frontend/front_end/platform/utilities.js(1157,15): error TS2339: Property 'valuesArray' does not exist on type 'Map<any, any>'.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user