Add optional argument to readConfigFile

Which allows the caller to specify the `System` used to read the file.
This commit is contained in:
Wesley Wigham
2015-08-27 11:40:21 -07:00
parent c9c6d82376
commit 3598b906e3

View File

@@ -374,10 +374,10 @@ namespace ts {
* Read tsconfig.json file
* @param fileName The path to the config file
*/
export function readConfigFile(fileName: string): { config?: any; error?: Diagnostic } {
export function readConfigFile(fileName: string, system: System = sys): { config?: any; error?: Diagnostic } {
let text = "";
try {
text = sys.readFile(fileName);
text = system.readFile(fileName);
}
catch (e) {
return { error: createCompilerDiagnostic(Diagnostics.Cannot_read_file_0_Colon_1, fileName, e.message) };