mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-18 17:27:54 -05:00
Enable clorizer unit tests
This commit is contained in:
@@ -271,6 +271,11 @@ module Harness.LanguageService {
|
||||
return this.ls;
|
||||
}
|
||||
|
||||
/** Return a new instance of the classifier service shim */
|
||||
public getClassifier(): ts.ClassifierShim {
|
||||
return new TypeScript.Services.TypeScriptServicesFactory().createClassifierShim(this);
|
||||
}
|
||||
|
||||
/** Parse file given its source text */
|
||||
public parseSourceText(fileName: string, sourceText: TypeScript.IScriptSnapshot): TypeScript.SourceUnitSyntax {
|
||||
return TypeScript.Parser.parse(fileName, TypeScript.SimpleText.fromScriptSnapshot(sourceText), ts.ScriptTarget.ES5, TypeScript.isDTSFile(fileName)).sourceUnit();
|
||||
|
||||
@@ -99,6 +99,9 @@ if (runners.length === 0) {
|
||||
//// language services
|
||||
runners.push(new FourslashRunner());
|
||||
//runners.push(new GeneratedFourslashRunner());
|
||||
|
||||
// unittests
|
||||
runners.push(new UnitTestRunner(UnittestTestType.Services));
|
||||
}
|
||||
|
||||
sys.newLine = '\r\n';
|
||||
|
||||
@@ -8,7 +8,7 @@ enum UnittestTestType {
|
||||
}
|
||||
|
||||
class UnitTestRunner extends RunnerBase {
|
||||
constructor(public testType?: UnittestTestType) {
|
||||
constructor(public testType: UnittestTestType) {
|
||||
super();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,9 @@ class UnitTestRunner extends RunnerBase {
|
||||
case UnittestTestType.LanguageService:
|
||||
this.tests = this.enumerateFiles('tests/cases/unittests/ls');
|
||||
break;
|
||||
case UnittestTestType.Services:
|
||||
this.tests = this.enumerateFiles('tests/cases/unittests/services', /colorization.ts/);
|
||||
break;
|
||||
default:
|
||||
if (this.tests.length === 0) {
|
||||
throw new Error('Unsupported test cases: ' + this.testType);
|
||||
@@ -38,7 +41,7 @@ class UnitTestRunner extends RunnerBase {
|
||||
});
|
||||
harnessCompiler.addInputFiles(toBeAdded);
|
||||
harnessCompiler.setCompilerOptions({ noResolve: true });
|
||||
|
||||
|
||||
var stdout = new Harness.Compiler.EmitterIOHost();
|
||||
var emitDiagnostics = harnessCompiler.emitAll(stdout);
|
||||
var results = stdout.toArray();
|
||||
@@ -59,7 +62,8 @@ class UnitTestRunner extends RunnerBase {
|
||||
before: before,
|
||||
after: after,
|
||||
Harness: Harness,
|
||||
IO: Harness.IO
|
||||
IO: Harness.IO,
|
||||
ts:ts
|
||||
// FourSlash: FourSlash
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user