fix(compiler-cli): ensure LogicalProjectPaths always start with a slash (#29627)
Previously, if a matching rootDir ended with a slash then the path returned from `logicalPathOfFile()` would not start with a slash, which is inconsistent. PR Close #29627
This commit is contained in:

committed by
Igor Minar

parent
ec56354306
commit
e02684e609
@ -31,6 +31,16 @@ describe('logical paths', () => {
|
||||
expect(fs.logicalPathOfFile(abs('/test/foo.ts'))).toEqual('/foo' as LogicalProjectPath);
|
||||
expect(fs.logicalPathOfFile(abs('/test/dist/foo.ts'))).toEqual('/foo' as LogicalProjectPath);
|
||||
});
|
||||
|
||||
it('should always return `/` prefixed logical paths', () => {
|
||||
const rootFs = new LogicalFileSystem([abs('/')]);
|
||||
expect(rootFs.logicalPathOfFile(abs('/foo/foo.ts')))
|
||||
.toEqual('/foo/foo' as LogicalProjectPath);
|
||||
|
||||
const nonRootFs = new LogicalFileSystem([abs('/test/')]);
|
||||
expect(nonRootFs.logicalPathOfFile(abs('/test/foo/foo.ts')))
|
||||
.toEqual('/foo/foo' as LogicalProjectPath);
|
||||
});
|
||||
});
|
||||
|
||||
describe('utilities', () => {
|
||||
|
Reference in New Issue
Block a user