diff --git a/.gitignore b/.gitignore index a05a65c95c1..21d79becb15 100644 --- a/.gitignore +++ b/.gitignore @@ -37,4 +37,5 @@ tests/*.d.ts scripts/debug.bat scripts/run.bat scripts/word2md.js +scripts/ior.js coverage/ diff --git a/scripts/ior.ts b/scripts/ior.ts new file mode 100644 index 00000000000..f0c142a266c --- /dev/null +++ b/scripts/ior.ts @@ -0,0 +1,123 @@ +/// + +import fs = require('fs'); +import path = require('path'); + +interface IOLog { + filesRead: { + path: string; + result: { contents: string; }; + }[]; + arguments: string[]; +} + +module Commands { + export function dir(obj: IOLog) { + obj.filesRead.filter(f => f.result !== undefined).forEach(f => { + console.log(f.path); + }); + } + dir['description'] = ': displays a list of files'; + + export function find(obj: IOLog, str: string) { + obj.filesRead.filter(f => f.result !== undefined).forEach(f => { + var lines = f.result.contents.split('\n'); + var printedHeader = false; + lines.forEach(line => { + if (line.indexOf(str) >= 0) { + if (!printedHeader) { + console.log(' === ' + f.path + ' ==='); + printedHeader = true; + } + console.log(line); + } + }); + }); + } + find['description'] = ' string: finds text in files'; + + export function grab(obj: IOLog, filename: string) { + obj.filesRead.filter(f => f.result !== undefined).forEach(f => { + if (path.basename(f.path) === filename) { + fs.writeFile(filename, f.result.contents); + } + }); + } + grab['description'] = ' filename.ts: writes out the specified file to disk'; + + export function extract(obj: IOLog, outputFolder: string) { + var directorySeparator = "/"; + function directoryExists(path: string): boolean { + return fs.existsSync(path) && fs.statSync(path).isDirectory(); + } + function getDirectoryPath(path: string) { + return path.substr(0, Math.max(getRootLength(path), path.lastIndexOf(directorySeparator))); + } + function getRootLength(path: string): number { + if (path.charAt(0) === directorySeparator) { + if (path.charAt(1) !== directorySeparator) return 1; + var p1 = path.indexOf(directorySeparator, 2); + if (p1 < 0) return 2; + var p2 = path.indexOf(directorySeparator, p1 + 1); + if (p2 < 0) return p1 + 1; + return p2 + 1; + } + if (path.charAt(1) === ":") { + if (path.charAt(2) === directorySeparator) return 3; + return 2; + } + return 0; + } + function ensureDirectoriesExist(directoryPath: string) { + if (directoryPath.length > getRootLength(directoryPath) && !directoryExists(directoryPath)) { + var parentDirectory = getDirectoryPath(directoryPath); + ensureDirectoriesExist(parentDirectory); + console.log("creating directory: " + directoryPath); + fs.mkdirSync(directoryPath); + } + } + function transalatePath(outputFolder:string, path: string): string { + return outputFolder + directorySeparator + path.replace(":", ""); + } + function fileExists(path: string): boolean { + return fs.existsSync(path); + } + obj.filesRead.forEach(f => { + var filename = transalatePath(outputFolder, f.path); + ensureDirectoriesExist(getDirectoryPath(filename)); + console.log("writing filename: " + filename); + fs.writeFile(filename, f.result.contents, (err) => { }); + }); + + console.log("Command: tsc "); + obj.arguments.forEach(a => { + if (getRootLength(a) > 0) { + console.log(transalatePath(outputFolder, a)); + } + else { + console.log(a); + } + console.log(" "); + }); + } + extract['description'] = ' outputFolder: extract all input files to '; +} + +var args = process.argv.slice(2); +if (args.length < 2) { + console.log('Usage: node ior.js path_to_file.json [command]'); + console.log('List of commands: '); + Object.keys(Commands).forEach(k => console.log(' ' + k + Commands[k]['description'])); +} else { + var cmd: Function = Commands[args[1]]; + if (cmd === undefined) { + console.log('Unknown command ' + args[1]); + } else { + fs.readFile(args[0], 'utf-8', (err, data) => { + if (err) throw err; + var json = JSON.parse(data); + cmd.apply(undefined, [json].concat(args.slice(2))); + }); + } +} + diff --git a/src/harness/compilerRunner.ts b/src/harness/compilerRunner.ts index 31d009c4765..6e211892437 100644 --- a/src/harness/compilerRunner.ts +++ b/src/harness/compilerRunner.ts @@ -61,9 +61,11 @@ class CompilerBaselineRunner extends RunnerBase { var otherFiles: { unitName: string; content: string }[]; var harnessCompiler: Harness.Compiler.HarnessCompiler; - var declToBeCompiled: { unitName: string; content: string }[] = []; - var declOtherFiles: { unitName: string; content: string }[] = []; - var declResult: Harness.Compiler.CompilerResult; + var declFileCompilationResult: { + declInputFiles: { unitName: string; content: string }[]; + declOtherFiles: { unitName: string; content: string }[]; + declResult: Harness.Compiler.CompilerResult; + }; var createNewInstance = false; @@ -147,9 +149,7 @@ class CompilerBaselineRunner extends RunnerBase { toBeCompiled = undefined; otherFiles = undefined; harnessCompiler = undefined; - declToBeCompiled = undefined; - declOtherFiles = undefined; - declResult = undefined; + declFileCompilationResult = undefined; }); function getByteOrderMarkText(file: Harness.Compiler.GeneratedFile): string { @@ -173,61 +173,18 @@ class CompilerBaselineRunner extends RunnerBase { // Source maps? it('Correct sourcemap content for ' + fileName, () => { - if (result.sourceMapRecord) { + if (options.sourceMap) { Harness.Baseline.runBaseline('Correct sourcemap content for ' + fileName, justName.replace(/\.ts$/, '.sourcemap.txt'), () => { - return result.sourceMapRecord; + return result.getSourceMapRecord(); }); } }); // Compile .d.ts files it('Correct compiler generated.d.ts for ' + fileName, () => { - if (options.declaration && result.errors.length === 0 && result.declFilesCode.length !== result.files.length) { - throw new Error('There were no errors and declFiles generated did not match number of js files generated'); - } - - // if the .d.ts is non-empty, confirm it compiles correctly as well - if (options.declaration && result.errors.length === 0 && result.declFilesCode.length > 0) { - function addDtsFile(file: { unitName: string; content: string }, dtsFiles: { unitName: string; content: string }[]) { - if (Harness.Compiler.isDTS(file.unitName)) { - dtsFiles.push(file); - } - else { - var declFile = findResultCodeFile(file.unitName); - // Look if there is --out file corresponding to this ts file - if (!declFile && options.out) { - declFile = findResultCodeFile(options.out); - if (!declFile || findUnit(declFile.fileName, declToBeCompiled) || - findUnit(declFile.fileName, declOtherFiles)) { - return; - } - } - - if (declFile) { - dtsFiles.push({ unitName: declFile.fileName, content: declFile.code }); - return; - } - } - - function findResultCodeFile(fileName: string) { - return ts.forEach(result.declFilesCode, - declFile => declFile.fileName === (fileName.substr(0, fileName.length - ".ts".length) + ".d.ts") - ? declFile : undefined); - } - - function findUnit(fileName: string, units: { unitName: string; content: string }[]) { - return ts.forEach(units, unit => unit.unitName === fileName ? unit : undefined); - } - } - - ts.forEach(toBeCompiled, file => addDtsFile(file, declToBeCompiled)); - ts.forEach(otherFiles, file => addDtsFile(file, declOtherFiles)); - harnessCompiler.compileFiles(declToBeCompiled, declOtherFiles, function (compileResult) { - declResult = compileResult; - }, function (settings) { - harnessCompiler.setCompilerSettings(tcSettings); - }); - } + declFileCompilationResult = harnessCompiler.compileDeclarationFiles(toBeCompiled, otherFiles, result, function (settings) { + harnessCompiler.setCompilerSettings(tcSettings); + }, options); }); @@ -267,10 +224,10 @@ class CompilerBaselineRunner extends RunnerBase { } } - if (declResult && declResult.errors.length) { + if (declFileCompilationResult && declFileCompilationResult.declResult.errors.length) { jsCode += '\r\n\r\n//// [DtsFileErrors]\r\n'; jsCode += '\r\n\r\n'; - jsCode += getErrorBaseline(declToBeCompiled, declOtherFiles, declResult); + jsCode += getErrorBaseline(declFileCompilationResult.declInputFiles, declFileCompilationResult.declOtherFiles, declFileCompilationResult.declResult); } if (jsCode.length > 0) { diff --git a/src/harness/harness.ts b/src/harness/harness.ts index e35fe83f9b2..2f7bf780b41 100644 --- a/src/harness/harness.ts +++ b/src/harness/harness.ts @@ -139,6 +139,7 @@ module Harness { deleteFile(filename: string): void; listFiles(path: string, filter: RegExp, options?: { recursive?: boolean }): string[]; log(text: string): void; + getMemoryUsage? (): number; } module IOImpl { @@ -275,6 +276,13 @@ module Harness { return filesInFolder(path); } + + export var getMemoryUsage: typeof IO.getMemoryUsage = () => { + if (global.gc) { + global.gc(); + } + return process.memoryUsage().heapUsed; + } } export module Network { @@ -804,15 +812,81 @@ module Harness { }); this.lastErrors = errors; - var result = new CompilerResult(fileOutputs, errors, []); - // Covert the source Map data into the baseline - result.updateSourceMapRecord(program, emitResult ? emitResult.sourceMaps : undefined); + var result = new CompilerResult(fileOutputs, errors, program, sys.getCurrentDirectory(), emitResult ? emitResult.sourceMaps : undefined); onComplete(result, checker); // reset what newline means in case the last test changed it sys.newLine = '\r\n'; return options; } + + public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[], + otherFiles: { unitName: string; content: string; }[], + result: CompilerResult, + settingsCallback?: (settings: ts.CompilerOptions) => void, + options?: ts.CompilerOptions) { + if (options.declaration && result.errors.length === 0 && result.declFilesCode.length !== result.files.length) { + throw new Error('There were no errors and declFiles generated did not match number of js files generated'); + } + + // if the .d.ts is non-empty, confirm it compiles correctly as well + if (options.declaration && result.errors.length === 0 && result.declFilesCode.length > 0) { + var declInputFiles: { unitName: string; content: string }[] = []; + var declOtherFiles: { unitName: string; content: string }[] = []; + var declResult: Harness.Compiler.CompilerResult; + + ts.forEach(inputFiles, file => addDtsFile(file, declInputFiles)); + ts.forEach(otherFiles, file => addDtsFile(file, declOtherFiles)); + this.compileFiles(declInputFiles, declOtherFiles, function (compileResult) { + declResult = compileResult; + }, settingsCallback, options); + + return { declInputFiles: declInputFiles, declOtherFiles: declOtherFiles, declResult: declResult }; + } + + function addDtsFile(file: { unitName: string; content: string }, dtsFiles: { unitName: string; content: string }[]) { + if (isDTS(file.unitName)) { + dtsFiles.push(file); + } + else if (isTS(file.unitName)) { + var declFile = findResultCodeFile(file.unitName); + if (!findUnit(declFile.fileName, declInputFiles) && !findUnit(declFile.fileName, declOtherFiles)) { + dtsFiles.push({ unitName: declFile.fileName, content: declFile.code }); + } + } + + function findResultCodeFile(fileName: string) { + var dTsFileName = ts.forEach(result.program.getSourceFiles(), sourceFile => { + if (sourceFile.filename === fileName) { + // Is this file going to be emitted separately + var sourceFileName: string; + if (ts.isExternalModule(sourceFile) || !options.out) { + if (options.outDir) { + var sourceFilePath = ts.getNormalizedPathFromPathComponents(ts.getNormalizedPathComponents(sourceFile.filename, result.currentDirectoryForProgram)); + sourceFilePath = sourceFilePath.replace(result.program.getCommonSourceDirectory(), ""); + sourceFileName = ts.combinePaths(options.outDir, sourceFilePath); + } + else { + sourceFileName = sourceFile.filename; + } + } + else { + // Goes to single --out file + sourceFileName = options.out; + } + + return ts.removeFileExtension(sourceFileName) + ".d.ts"; + } + }); + + return ts.forEach(result.declFilesCode, declFile => declFile.fileName === dTsFileName ? declFile : undefined); + } + + function findUnit(fileName: string, units: { unitName: string; content: string; }[]) { + return ts.forEach(units, unit => unit.unitName === fileName ? unit : undefined); + } + } + } } export function getMinimalDiagnostic(err: ts.Diagnostic): HarnessDiagnostic { @@ -948,10 +1022,6 @@ module Harness { } */ - /** Recreate the harness compiler instance to its default settings */ - export function recreate(options?: { useMinimalDefaultLib: boolean; noImplicitAny: boolean; }) { - } - /** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a test case (i.e., describe/it) */ var harnessCompiler: HarnessCompiler; @@ -991,6 +1061,10 @@ module Harness { return str.substr(str.length - end.length) === end; } + export function isTS(fileName: string) { + return stringEndsWith(fileName, '.ts'); + } + export function isDTS(fileName: string) { return stringEndsWith(fileName, '.d.ts'); } @@ -1009,10 +1083,10 @@ module Harness { public errors: HarnessDiagnostic[] = []; public declFilesCode: GeneratedFile[] = []; public sourceMaps: GeneratedFile[] = []; - public sourceMapRecord: string; /** @param fileResults an array of strings for the fileName and an ITextWriter with its code */ - constructor(fileResults: GeneratedFile[], errors: HarnessDiagnostic[], sourceMapRecordLines: string[]) { + constructor(fileResults: GeneratedFile[], errors: HarnessDiagnostic[], public program: ts.Program, + public currentDirectoryForProgram: string, private sourceMapData: ts.SourceMapData[]) { var lines: string[] = []; fileResults.forEach(emittedFile => { @@ -1030,12 +1104,11 @@ module Harness { }); this.errors = errors; - this.sourceMapRecord = sourceMapRecordLines.join('\r\n'); } - public updateSourceMapRecord(program: ts.Program, sourceMapData: ts.SourceMapData[]) { - if (sourceMapData) { - this.sourceMapRecord = Harness.SourceMapRecoder.getSourceMapRecord(sourceMapData, program, this.files); + public getSourceMapRecord() { + if (this.sourceMapData) { + return Harness.SourceMapRecoder.getSourceMapRecord(this.sourceMapData, this.program, this.files); } } diff --git a/src/harness/projectsRunner.ts b/src/harness/projectsRunner.ts index 2886c43f091..797bc12a42b 100644 --- a/src/harness/projectsRunner.ts +++ b/src/harness/projectsRunner.ts @@ -419,6 +419,16 @@ class ProjectRunner extends RunnerBase { // }) //}); } + + after(() => { + // Mocha holds onto the closure environment of the describe callback even after the test is done. + // Therefore we have to clean out large objects after the test is done. + nodeCompilerResult = undefined; + amdCompilerResult = undefined; + testCase = undefined; + testFileText = undefined; + testCaseJustName = undefined; + }); }); } } \ No newline at end of file diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index f7cc699c075..6590344a8dd 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -46,144 +46,171 @@ module RWC { } export function runRWCTest(jsonPath: string) { - var harnessCompiler = Harness.Compiler.getCompiler(); - var opts: ts.ParsedCommandLine; + describe("Testing a RWC project: " + jsonPath, () => { + var inputFiles: { unitName: string; content: string; }[] = []; + var otherFiles: { unitName: string; content: string; }[] = []; + var compilerResult: Harness.Compiler.CompilerResult; + var compilerOptions: ts.CompilerOptions; + var baselineOpts: Harness.Baseline.BaselineOptions = { Subfolder: 'rwc' }; + var baseName = /(.*)\/(.*).json/.exec(Harness.Path.switchToForwardSlashes(jsonPath))[2]; + // Compile .d.ts files + var declFileCompilationResult: { + declInputFiles: { unitName: string; content: string }[]; + declOtherFiles: { unitName: string; content: string }[]; + declResult: Harness.Compiler.CompilerResult; + }; - var ioLog: IOLog = JSON.parse(Harness.IO.readFile(jsonPath)); - var errors = ''; - - it('has parsable options', () => { - runWithIOLog(ioLog, () => { - opts = ts.parseCommandLine(ioLog.arguments); - assert.equal(opts.errors.length, 0); - }); - }); - - var inputFiles: { unitName: string; content: string; }[] = []; - var otherFiles: { unitName: string; content: string; }[] = []; - var compilerResult: Harness.Compiler.CompilerResult; - it('can compile', () => { - runWithIOLog(ioLog, () => { - harnessCompiler.reset(); - - // Load the files - ts.forEach(opts.filenames, fileName => { - inputFiles.push(getHarnessCompilerInputUnit(fileName)); - }); - - if (!opts.options.noLib) { - // Find the lib.d.ts file in the input file and add it to the input files list - var libFile = ts.forEach(ioLog.filesRead, fileRead=> Harness.isLibraryFile(fileRead.path) ? fileRead.path : undefined); - if (libFile) { - inputFiles.push(getHarnessCompilerInputUnit(libFile)); - } - } - - ts.forEach(ioLog.filesRead, fileRead => { - var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileRead.path)); - var inInputList = ts.forEach(inputFiles, inputFile=> inputFile.unitName === resolvedPath); - if (!inInputList) { - // Add the file to other files - otherFiles.push(getHarnessCompilerInputUnit(fileRead.path)); - } - }); - - // do not use lib since we already read it in above - opts.options.noLib = true; - - // Emit the results - harnessCompiler.compileFiles(inputFiles, otherFiles, compileResult => { - compilerResult = compileResult; - }, /*settingsCallback*/ undefined, opts.options); + after(() => { + // Mocha holds onto the closure environment of the describe callback even after the test is done. + // Therefore we have to clean out large objects after the test is done. + inputFiles = undefined; + otherFiles = undefined; + compilerResult = undefined; + compilerOptions = undefined; + baselineOpts = undefined; + baseName = undefined; + declFileCompilationResult = undefined; }); - function getHarnessCompilerInputUnit(fileName: string) { - var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileName)); - try { - var content = sys.readFile(resolvedPath); + it('can compile', () => { + var harnessCompiler = Harness.Compiler.getCompiler(); + var opts: ts.ParsedCommandLine; + + var ioLog: IOLog = JSON.parse(Harness.IO.readFile(jsonPath)); + runWithIOLog(ioLog, () => { + opts = ts.parseCommandLine(ioLog.arguments); + assert.equal(opts.errors.length, 0); + }); + + runWithIOLog(ioLog, () => { + harnessCompiler.reset(); + + // Load the files + ts.forEach(opts.filenames, fileName => { + inputFiles.push(getHarnessCompilerInputUnit(fileName)); + }); + + if (!opts.options.noLib) { + // Find the lib.d.ts file in the input file and add it to the input files list + var libFile = ts.forEach(ioLog.filesRead, fileRead=> Harness.isLibraryFile(fileRead.path) ? fileRead.path : undefined); + if (libFile) { + inputFiles.push(getHarnessCompilerInputUnit(libFile)); + } + } + + ts.forEach(ioLog.filesRead, fileRead => { + var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileRead.path)); + var inInputList = ts.forEach(inputFiles, inputFile=> inputFile.unitName === resolvedPath); + if (!inInputList) { + // Add the file to other files + otherFiles.push(getHarnessCompilerInputUnit(fileRead.path)); + } + }); + + // do not use lib since we already read it in above + opts.options.noLib = true; + + // Emit the results + compilerOptions = harnessCompiler.compileFiles(inputFiles, otherFiles, compileResult => { + compilerResult = compileResult; + }, /*settingsCallback*/ undefined, opts.options); + }); + + function getHarnessCompilerInputUnit(fileName: string) { + var resolvedPath = Harness.Path.switchToForwardSlashes(sys.resolvePath(fileName)); + try { + var content = sys.readFile(resolvedPath); + } + catch (e) { + // Leave content undefined. + } + return { unitName: resolvedPath, content: content }; } - catch (e) { - // Leave content undefined. - } - return { unitName: resolvedPath, content: content }; - } - }); + }); - // Baselines - var baselineOpts: Harness.Baseline.BaselineOptions = { Subfolder: 'rwc' }; - var baseName = /(.*)\/(.*).json/.exec(Harness.Path.switchToForwardSlashes(jsonPath))[2]; + // Baselines + it('Correct compiler generated.d.ts', () => { + declFileCompilationResult = Harness.Compiler.getCompiler().compileDeclarationFiles(inputFiles, otherFiles, compilerResult, /*settingscallback*/ undefined, compilerOptions); + }); - it('has the expected emitted code', () => { - Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => { - return collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s)); - }, false, baselineOpts); - }); - it('has the expected declaration file content', () => { - Harness.Baseline.runBaseline('has the expected declaration file content', baseName + '.d.ts', () => { - if (compilerResult.errors.length || !compilerResult.declFilesCode.length) { - return null; - } - return collateOutputs(compilerResult.declFilesCode); - }, false, baselineOpts); - }); - - it('has the expected source maps', () => { - Harness.Baseline.runBaseline('has the expected source maps', baseName + '.map', () => { - if (!compilerResult.sourceMaps.length) { - return null; - } - - return collateOutputs(compilerResult.sourceMaps); - }, false, baselineOpts); - }); - - it('has correct source map record', () => { - if (compilerResult.sourceMapRecord) { - Harness.Baseline.runBaseline('has correct source map record', baseName + '.sourcemap.txt', () => { - return compilerResult.sourceMapRecord; + it('has the expected emitted code', () => { + Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => { + return collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s)); }, false, baselineOpts); - } - }); + }); - it('has the expected errors', () => { - Harness.Baseline.runBaseline('has the expected errors', baseName + '.errors.txt', () => { - if (compilerResult.errors.length === 0) { - return null; + it('has the expected declaration file content', () => { + Harness.Baseline.runBaseline('has the expected declaration file content', baseName + '.d.ts', () => { + if (compilerResult.errors.length || !compilerResult.declFilesCode.length) { + return null; + } + return collateOutputs(compilerResult.declFilesCode); + }, false, baselineOpts); + }); + + it('has the expected source maps', () => { + Harness.Baseline.runBaseline('has the expected source maps', baseName + '.map', () => { + if (!compilerResult.sourceMaps.length) { + return null; + } + + return collateOutputs(compilerResult.sourceMaps); + }, false, baselineOpts); + }); + + //it('has correct source map record', () => { + // if (compilerOptions.sourceMap) { + // Harness.Baseline.runBaseline('has correct source map record', baseName + '.sourcemap.txt', () => { + // return compilerResult.getSourceMapRecord(); + // }, false, baselineOpts); + // } + //}); + + it('has the expected errors', () => { + Harness.Baseline.runBaseline('has the expected errors', baseName + '.errors.txt', () => { + if (compilerResult.errors.length === 0) { + return null; + } + + return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors); + }, false, baselineOpts); + }); + + it('has no errors in generated declaration files', () => { + if (compilerOptions.declaration && !compilerResult.errors.length) { + Harness.Baseline.runBaseline('has no errors in generated declaration files', baseName + '.dts.errors.txt', () => { + if (declFileCompilationResult.declResult.errors.length === 0) { + return null; + } + + return Harness.Compiler.minimalDiagnosticsToString(declFileCompilationResult.declResult.errors) + + sys.newLine + sys.newLine + + Harness.Compiler.getErrorBaseline(declFileCompilationResult.declInputFiles.concat(declFileCompilationResult.declOtherFiles), declFileCompilationResult.declResult.errors); + }, false, baselineOpts); } + }); - return Harness.Compiler.getErrorBaseline(inputFiles.concat(otherFiles), compilerResult.errors); - }, false, baselineOpts); + // TODO: Type baselines (need to refactor out from compilerRunner) }); - - // TODO: Type baselines (need to refactor out from compilerRunner) } } class RWCRunner extends RunnerBase { - private runnerPath = "tests/runners/rwc"; - private sourcePath = "tests/cases/rwc/"; - - private harnessCompiler: Harness.Compiler.HarnessCompiler; + private static sourcePath = "tests/cases/rwc/"; /** Setup the runner's tests so that they are ready to be executed by the harness * The first test should be a describe/it block that sets up the harness's compiler instance appropriately */ public initializeTests(): void { - // Recreate the compiler with the default lib - Harness.Compiler.recreate({ useMinimalDefaultLib: false, noImplicitAny: false }); - this.harnessCompiler = Harness.Compiler.getCompiler(); - // Read in and evaluate the test list - var testList = Harness.IO.listFiles(this.sourcePath, /.+\.json$/); + var testList = Harness.IO.listFiles(RWCRunner.sourcePath, /.+\.json$/); for (var i = 0; i < testList.length; i++) { this.runTest(testList[i]); } } private runTest(jsonFilename: string) { - describe("Testing a RWC project: " + jsonFilename, () => { - RWC.runRWCTest(jsonFilename); - }); + RWC.runRWCTest(jsonFilename); } } \ No newline at end of file