Make boolean compiler options in harness true only if they say 'true'

This commit is contained in:
Jason Freeman
2015-05-08 13:43:13 -07:00
parent 5aed73ff72
commit 80f33dd3ea
43 changed files with 19 additions and 1495 deletions

View File

@@ -144,10 +144,10 @@ module FourSlash {
if (globalOptions.hasOwnProperty(prop)) {
switch (prop) {
case metadataOptionNames.allowNonTsExtensions:
settings.allowNonTsExtensions = true;
settings.allowNonTsExtensions = globalOptions[prop] === "true";
break;
case metadataOptionNames.declaration:
settings.declaration = true;
settings.declaration = globalOptions[prop] === "true";
break;
case metadataOptionNames.mapRoot:
settings.mapRoot = globalOptions[prop];
@@ -174,7 +174,7 @@ module FourSlash {
settings.outDir = globalOptions[prop];
break;
case metadataOptionNames.sourceMap:
settings.sourceMap = true;
settings.sourceMap = globalOptions[prop] === "true";
break;
case metadataOptionNames.sourceRoot:
settings.sourceRoot = globalOptions[prop];
@@ -308,7 +308,7 @@ module FourSlash {
ts.forEach(testData.files, file => {
// Create map between fileName and its content for easily looking up when resolveReference flag is specified
this.inputFiles[file.fileName] = file.content;
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference]) {
if (!startResolveFileRef && file.fileOptions[metadataOptionNames.resolveReference] === "true") {
startResolveFileRef = file;
} else if (startResolveFileRef) {
// If entry point for resolving file references is already specified, report duplication error
@@ -1158,7 +1158,7 @@ module FourSlash {
var allFourSlashFiles = this.testData.files;
for (var idx = 0; idx < allFourSlashFiles.length; ++idx) {
var file = allFourSlashFiles[idx];
if (file.fileOptions[metadataOptionNames.emitThisFile]) {
if (file.fileOptions[metadataOptionNames.emitThisFile] === "true") {
// Find a file with the flag emitThisFile turned on
emitFiles.push(file);
}

View File

@@ -1008,19 +1008,19 @@ module Harness {
break;
case 'noemitonerror':
options.noEmitOnError = !!setting.value;
options.noEmitOnError = setting.value === 'true';
break;
case 'noresolve':
options.noResolve = !!setting.value;
options.noResolve = setting.value === 'true';
break;
case 'noimplicitany':
options.noImplicitAny = !!setting.value;
options.noImplicitAny = setting.value === 'true';
break;
case 'nolib':
options.noLib = !!setting.value;
options.noLib = setting.value === 'true';
break;
case 'out':
@@ -1042,11 +1042,11 @@ module Harness {
break;
case 'sourcemap':
options.sourceMap = !!setting.value;
options.sourceMap = setting.value === 'true';
break;
case 'declaration':
options.declaration = !!setting.value;
options.declaration = setting.value === 'true';
break;
case 'newline':
@@ -1070,7 +1070,7 @@ module Harness {
break;
case 'stripinternal':
options.stripInternal = !!setting.value;
options.stripInternal = setting.value === 'true';
case 'usecasesensitivefilenames':
useCaseSensitiveFileNames = setting.value === 'true';
@@ -1081,7 +1081,7 @@ module Harness {
break;
case 'emitbom':
options.emitBOM = !!setting.value;
options.emitBOM = setting.value === 'true';
break;
case 'errortruncation':