Merge pull request #223 from Microsoft/linuxTestFixes

Linux test fixes
This commit is contained in:
Dan Quirk
2014-07-23 17:22:47 -07:00
19 changed files with 600 additions and 875 deletions

View File

@@ -18,7 +18,7 @@
/// <reference path='..\compiler\sys.ts' />
/// <reference path='external\mocha.d.ts'/>
/// <reference path='external\chai.d.ts'/>
///<reference path='sourceMapRecorder.ts'/>
/// <reference path='sourceMapRecorder.ts'/>
// this will work in the browser via browserify
var _chai: typeof chai = require('chai');
@@ -598,7 +598,7 @@ module Harness {
this.inputFiles.push(file);
}
public compile(options?: ts.CompilerOptions) {
public setCompilerOptions(options?: ts.CompilerOptions) {
this.compileOptions = options || { noResolve: false };
}
@@ -624,7 +624,7 @@ module Harness {
settingsCallback(null);
}
this.settings.forEach(setting => {
this.settings.forEach(setting => {
switch (setting.flag.toLowerCase()) {
// "filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve"
case "module":
@@ -692,6 +692,10 @@ module Harness {
case 'declaration':
options.declaration = !!setting.value;
break;
case 'newline':
case 'newlines':
sys.newLine = setting.value;
break;
case 'mapsourcefiles':
case 'maproot':
@@ -753,6 +757,9 @@ module Harness {
// Covert the source Map data into the baseline
result.updateSourceMapRecord(program, sourceMapData);
onComplete(result);
// reset what newline means in case the last test changed it
sys.newLine = '\r\n';
return options;
}
}
@@ -891,7 +898,7 @@ module Harness {
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
// List of allowed metadata names
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve"];
var fileMetadataNames = ["filename", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outDir", "noimplicitany", "noresolve", "newline", "newlines"];
function extractCompilerSettings(content: string): CompilerSetting[] {
@@ -1119,7 +1126,7 @@ module Harness {
return filePath.indexOf('lib.d.ts') >= 0 || filePath.indexOf('lib.core.d.ts') >= 0;
}
if (Error) (<any>Error).stackTraceLimit = 100;
if (Error) (<any>Error).stackTraceLimit = 1;
}
// TODO: not sure why Utils.evalFile isn't working with this, eventually will concat it like old compiler instead of eval

View File

@@ -104,4 +104,6 @@ if (runners.length === 0) {
// runners.push(new GeneratedFourslashRunner());
}
sys.newLine = '\r\n';
runTests(runners);

View File

@@ -143,7 +143,7 @@ module RWC {
harnessCompiler.addInputFile({ unitName: resolvedPath, content: content });
});
harnessCompiler.compile();
harnessCompiler.setCompilerOptions();
// Emit the results
harnessCompiler.emitAll(emitterIOHost);

View File

@@ -37,7 +37,7 @@ class UnitTestRunner extends RunnerBase {
return { unitName: test, content: Harness.IO.readFile(test) }
});
harnessCompiler.addInputFiles(toBeAdded);
harnessCompiler.compile({ noResolve: true });
harnessCompiler.setCompilerOptions({ noResolve: true });
var stdout = new Harness.Compiler.EmitterIOHost();
var emitDiagnostics = harnessCompiler.emitAll(stdout);