Skip to content

Commit 1dff0af

Browse files
committed
More path cleanup
1 parent 4863d55 commit 1dff0af

File tree

14 files changed

+759
-492
lines changed

14 files changed

+759
-492
lines changed

src/compiler/commandLineParser.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1819,7 +1819,7 @@ namespace ts {
18191819
}
18201820

18211821
function getDefaultCompilerOptions(configFileName?: string) {
1822-
const options: CompilerOptions = getBaseFileName(configFileName) === "jsconfig.json"
1822+
const options: CompilerOptions = configFileName && getBaseFileName(configFileName) === "jsconfig.json"
18231823
? { allowJs: true, maxNodeModuleJsDepth: 2, allowSyntheticDefaultImports: true, skipLibCheck: true, noEmit: true }
18241824
: {};
18251825
return options;
@@ -1834,7 +1834,7 @@ namespace ts {
18341834
}
18351835

18361836
function getDefaultTypeAcquisition(configFileName?: string): TypeAcquisition {
1837-
return { enable: getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
1837+
return { enable: configFileName && getBaseFileName(configFileName) === "jsconfig.json", include: [], exclude: [] };
18381838
}
18391839

18401840
function convertTypeAcquisitionFromJsonWorker(jsonOptions: any,

src/compiler/core.ts

Lines changed: 381 additions & 200 deletions
Large diffs are not rendered by default.

src/compiler/program.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ namespace ts {
5757
return currentDirectory;
5858
}
5959

60-
return getNormalizedPathFromPathComponents(commonPathComponents);
60+
return getPathFromPathComponents(commonPathComponents);
6161
}
6262

6363
interface OutputFingerprint {

src/compiler/watchUtilities.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace ts {
6363
}
6464

6565
function getCachedFileSystemEntries(rootDirPath: Path): MutableFileSystemEntries | undefined {
66-
return cachedReadDirectoryResult.get(rootDirPath);
66+
return cachedReadDirectoryResult.get(ensureTrailingDirectorySeparator(rootDirPath));
6767
}
6868

6969
function getCachedFileSystemEntriesForBaseDir(path: Path): MutableFileSystemEntries | undefined {
@@ -80,7 +80,7 @@ namespace ts {
8080
directories: host.getDirectories(rootDir) || []
8181
};
8282

83-
cachedReadDirectoryResult.set(rootDirPath, resultFromHost);
83+
cachedReadDirectoryResult.set(ensureTrailingDirectorySeparator(rootDirPath), resultFromHost);
8484
return resultFromHost;
8585
}
8686

@@ -90,6 +90,7 @@ namespace ts {
9090
* The host request is done under try catch block to avoid caching incorrect result
9191
*/
9292
function tryReadDirectory(rootDir: string, rootDirPath: Path): MutableFileSystemEntries | undefined {
93+
rootDirPath = ensureTrailingDirectorySeparator(rootDirPath);
9394
const cachedResult = getCachedFileSystemEntries(rootDirPath);
9495
if (cachedResult) {
9596
return cachedResult;
@@ -100,7 +101,7 @@ namespace ts {
100101
}
101102
catch (_e) {
102103
// If there is exception to read directories, dont cache the result and direct the calls to host
103-
Debug.assert(!cachedReadDirectoryResult.has(rootDirPath));
104+
Debug.assert(!cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(rootDirPath)));
104105
return undefined;
105106
}
106107
}
@@ -142,7 +143,7 @@ namespace ts {
142143

143144
function directoryExists(dirPath: string): boolean {
144145
const path = toPath(dirPath);
145-
return cachedReadDirectoryResult.has(path) || host.directoryExists(dirPath);
146+
return cachedReadDirectoryResult.has(ensureTrailingDirectorySeparator(path)) || host.directoryExists(dirPath);
146147
}
147148

148149
function createDirectory(dirPath: string) {

src/harness/parallel/worker.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,14 @@ namespace Harness.Parallel.Worker {
2828
(global as any).describe = ((name, callback) => {
2929
testList.push({ name, callback, kind: "suite" });
3030
}) as Mocha.IContextDefinition;
31+
(global as any).describe.skip = ts.noop;
3132
(global as any).it = ((name, callback) => {
3233
if (!testList) {
3334
throw new Error("Tests must occur within a describe block");
3435
}
3536
testList.push({ name, callback, kind: "test" });
3637
}) as Mocha.ITestDefinition;
38+
(global as any).it.skip = ts.noop;
3739
}
3840

3941
function setTimeoutAndExecute(timeout: number | undefined, f: () => void) {

src/harness/projectsRunner.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,9 @@ namespace project {
210210
const ignoreCase = this.vfs.ignoreCase;
211211
const resolutionInfo: ProjectRunnerTestCaseResolutionInfo & ts.CompilerOptions = JSON.parse(JSON.stringify(this.testCase));
212212
resolutionInfo.resolvedInputFiles = this.compilerResult.program.getSourceFiles()
213-
.map(input => utils.removeTestPathPrefixes(vpath.isAbsolute(input.fileName) ? vpath.relative(cwd, input.fileName, ignoreCase) : input.fileName));
213+
.map(({ fileName: input }) => vpath.beneath(vfs.builtFolder, input, this.vfs.ignoreCase) || vpath.beneath(vfs.testLibFolder, input, this.vfs.ignoreCase) ? utils.removeTestPathPrefixes(input) :
214+
vpath.isAbsolute(input) ? vpath.relative(cwd, input, ignoreCase) :
215+
input);
214216

215217
resolutionInfo.emittedFiles = this.compilerResult.outputFiles
216218
.map(output => output.meta.get("fileName") || output.file)
@@ -255,7 +257,7 @@ namespace project {
255257
nonSubfolderDiskFiles++;
256258
}
257259

258-
const content = output.text.replace(/\/\/?\.src\//g, "/");
260+
const content = utils.removeTestPathPrefixes(output.text, /*retainTrailingDirectorySeparator*/ true);
259261
Harness.Baseline.runBaseline(this.getBaselineFolder(this.compilerResult.moduleKind) + diskRelativeName, () => content);
260262
}
261263
catch (e) {

0 commit comments

Comments
 (0)