Don't access sys.newLine inside unit tests

This commit is contained in:
Andy Hanson
2017-04-11 14:23:26 -07:00
parent 1798e8f58b
commit 893e3242fb
3 changed files with 5 additions and 16 deletions

View File

@@ -6,22 +6,11 @@ namespace ts {
function initTSConfigCorrectly(name: string, commandLinesArgs: string[]) {
describe(name, () => {
const commandLine = parseCommandLine(commandLinesArgs);
const initResult = generateTSConfig(commandLine.options, commandLine.fileNames);
const initResult = generateTSConfig(commandLine.options, commandLine.fileNames, "\n");
const outputFileName = `tsConfig/${name.replace(/[^a-z0-9\-. ]/ig, "")}/tsconfig.json`;
it(`Correct output for ${outputFileName}`, () => {
Harness.Baseline.runBaseline(outputFileName, () => {
if (initResult) {
// normalize line endings
return initResult.replace(new RegExp(sys.newLine, "g"), "\n");
}
else {
// This can happen if compiler recieve invalid compiler-options
/* tslint:disable:no-null-keyword */
return null;
/* tslint:enable:no-null-keyword */
}
});
Harness.Baseline.runBaseline(outputFileName, () => initResult);
});
});
}