Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(compiler-cli): resolve
rootDirs
to absolute
Ensure that `rootDirs` are absolute by resolving them against the current working directory. Fixes #36290
- Loading branch information
1 parent
61bfa3d
commit 68840e2
Showing
2 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
packages/compiler-cli/src/ngtsc/util/test/typescript_spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import {FileSystem, getFileSystem} from '../../file_system'; | ||
import {runInEachFileSystem} from '../../file_system/testing'; | ||
import {getRootDirs} from '../src/typescript'; | ||
|
||
runInEachFileSystem(() => { | ||
let fs: FileSystem; | ||
|
||
beforeEach(() => { | ||
fs = getFileSystem(); | ||
}); | ||
|
||
describe('typescript', () => { | ||
it('should allow relative root directories', () => { | ||
const mockCompilerHost = { | ||
getCanonicalFileName: (val: string) => val, | ||
getCurrentDirectory: () => '/fs-root/projects' | ||
}; | ||
const result = getRootDirs(mockCompilerHost, {rootDir: './test-project-root'}); | ||
expect(result).toEqual([fs.resolve('/fs-root/projects/test-project-root')]); | ||
}); | ||
}); | ||
}); |