Skip to content

Commit e75a1e3

Browse files
author
Yui T
committed
Change getEmitOutputBaseline
1 parent 58f155d commit e75a1e3

File tree

5 files changed

+9
-29
lines changed

5 files changed

+9
-29
lines changed

src/harness/fourslash.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ module FourSlash {
182182
case testOptMetadataNames.sourceRoot:
183183
settings.sourceRoot = globalOptions[prop];
184184
break;
185-
186185
}
187186
}
188187
}
@@ -983,29 +982,9 @@ module FourSlash {
983982
emitFiles.forEach(emitFile => {
984983
var emitOutput = this.languageService.getEmitOutput(emitFile.fileName);
985984
var emitOutputStatus = emitOutput.emitOutputStatus;
986-
987985
// Print emitOutputStatus in readable format
988-
switch (emitOutputStatus) {
989-
case ts.EmitReturnStatus.Succeeded:
990-
resultString += "EmitOutputStatus : Succeeded\n";
991-
break;
992-
case ts.EmitReturnStatus.AllOutputGenerationSkipped:
993-
resultString += "EmitOutputStatus : AllOutputGenerationSkipped\n";
994-
break;
995-
case ts.EmitReturnStatus.JSGeneratedWithSemanticErrors:
996-
resultString += "EmitOutputStatus : JSGeneratedWithSemanticErrors\n";
997-
break;
998-
case ts.EmitReturnStatus.DeclarationGenerationSkipped:
999-
resultString += "EmitOutputStatus : DeclaratiionGenerationSkipped\n";
1000-
break;
1001-
case ts.EmitReturnStatus.EmitErrorsEncountered:
1002-
resultString += "EmitOutputStatus : EmitErrorEncountered\n";
1003-
break;
1004-
default:
1005-
resultString += "Invalid EmitOutputStatus\n";
1006-
break;
1007-
}
1008-
986+
resultString += "EmitOutputStatus : " + ts.EmitReturnStatus[emitOutputStatus];
987+
resultString += "\n";
1009988
emitOutput.outputFiles.forEach((outputFile, idx, array) => {
1010989
var filename = "Filename : " + outputFile.name + "\n";
1011990
resultString = resultString + filename + outputFile.text;

src/services/services.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ module ts {
14131413
getNewLine: () => "\r\n",
14141414
getDefaultLibFilename: (): string => {
14151415
// In the case there is no host (such as in fourslash test), return ""
1416-
return this.host !== undefined ? this.host.getDefaultLibFilename() : "";
1416+
return host.getDefaultLibFilename();
14171417
},
14181418
writeFile: (filename, data, writeByteOrderMark) => {
14191419
if (writer !== undefined) {
@@ -1422,7 +1422,7 @@ module ts {
14221422
},
14231423
getCurrentDirectory: (): string => {
14241424
// In the case there is no host (such as in fourslash test), return ""
1425-
return this.host !== undefined ? this.host.getCurrentDirectory() : "";
1425+
return host.getCurrentDirectory();
14261426
}
14271427
};
14281428
}
@@ -2869,11 +2869,12 @@ module ts {
28692869
} else {
28702870
// Check the syntactic of only sourceFiles that will get emitted into single output
28712871
// Terminate the process immediately if we encounter a syntax error from one of the sourceFiles
2872-
containSyntacticErrors = program.getSourceFiles().some((sourceFile) => {
2872+
containSyntacticErrors = forEach(program.getSourceFiles(), sourceFile => {
28732873
if (!isExternalModuleOrDeclarationFile(sourceFile)) {
28742874
// If emit to a single file then we will check all files that do not have external module
28752875
return containErrors(program.getDiagnostics(sourceFile));
28762876
}
2877+
return false;
28772878
});
28782879
}
28792880

tests/baselines/reference/getEmitOutputWithEmitterErrors.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
EmitOutputStatus : EmitErrorEncountered
1+
EmitOutputStatus : EmitErrorsEncountered
22
Filename : tests/cases/fourslash/inputFile.js
33
var M;
44
(function (M) {

tests/baselines/reference/getEmitOutputWithEmitterErrors2.baseline

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
EmitOutputStatus : EmitErrorEncountered
1+
EmitOutputStatus : EmitErrorsEncountered
22
Filename : tests/cases/fourslash/inputFile.js
33
define(["require", "exports"], function (require, exports) {
44
var C = (function () {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
EmitOutputStatus : DeclaratiionGenerationSkipped
1+
EmitOutputStatus : DeclarationGenerationSkipped
22
Filename : tests/cases/fourslash/inputFile.js
33
var x = "hello world";
44

0 commit comments

Comments
 (0)