fix(compiler-cli): isCaseSensitive()
returns correct value (#36859)
Previously this method was returning the exact opposite value than the correct one. Also, calling `this.exists()` causes an infinite recursions, so the actual file-system `fs.existsSync()` method is used to ascertain the case-sensitivity of the file-system. PR Close #36859
This commit is contained in:
parent
3f3e9b7555
commit
fc4741f638
@ -68,7 +68,9 @@ export class NodeJSFileSystem implements FileSystem {
|
|||||||
}
|
}
|
||||||
isCaseSensitive(): boolean {
|
isCaseSensitive(): boolean {
|
||||||
if (this._caseSensitive === undefined) {
|
if (this._caseSensitive === undefined) {
|
||||||
this._caseSensitive = this.exists(togglePathCase(__filename));
|
// Note the use of the real file-system is intentional:
|
||||||
|
// `this.exists()` relies upon `isCaseSensitive()` so that would cause an infinite recursion.
|
||||||
|
this._caseSensitive = !fs.existsSync(togglePathCase(__filename));
|
||||||
}
|
}
|
||||||
return this._caseSensitive;
|
return this._caseSensitive;
|
||||||
}
|
}
|
||||||
|
@ -153,14 +153,6 @@ describe('NodeJSFileSystem', () => {
|
|||||||
expect(mkdirCalls).toEqual([xPath, xyPath, xyzPath]);
|
expect(mkdirCalls).toEqual([xPath, xyPath, xyzPath]);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('removeDeep()', () => {
|
|
||||||
it('should delegate to fsExtra.remove()', () => {
|
|
||||||
const spy = spyOn(fsExtra, 'removeSync');
|
|
||||||
fs.removeDeep(abcPath);
|
|
||||||
expect(spy).toHaveBeenCalledWith(abcPath);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should not fail if a directory (that did not exist before) does exist when trying to create it',
|
it('should not fail if a directory (that did not exist before) does exist when trying to create it',
|
||||||
() => {
|
() => {
|
||||||
let abcPathExists = false;
|
let abcPathExists = false;
|
||||||
@ -228,4 +220,19 @@ describe('NodeJSFileSystem', () => {
|
|||||||
expect(isDirectorySpy).toHaveBeenCalledTimes(1);
|
expect(isDirectorySpy).toHaveBeenCalledTimes(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('removeDeep()', () => {
|
||||||
|
it('should delegate to fsExtra.remove()', () => {
|
||||||
|
const spy = spyOn(fsExtra, 'removeSync');
|
||||||
|
fs.removeDeep(abcPath);
|
||||||
|
expect(spy).toHaveBeenCalledWith(abcPath);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('isCaseSensitive()', () => {
|
||||||
|
it('should return true if the FS is case-sensitive', () => {
|
||||||
|
const isCaseSensitive = !realFs.existsSync(__filename.toUpperCase());
|
||||||
|
expect(fs.isCaseSensitive()).toEqual(isCaseSensitive);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user