Skip to content

Commit 0c8aa41

Browse files
committed
Merge pull request microsoft#5835 from Microsoft/noEmit
Do not emit files if noEmit is specified
2 parents 4092de6 + acedf3c commit 0c8aa41

4 files changed

Lines changed: 3 additions & 28 deletions

File tree

src/compiler/declarationEmitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,7 @@ namespace ts {
16751675
/* @internal */
16761676
export function writeDeclarationFile(declarationFilePath: string, sourceFiles: SourceFile[], isBundledEmit: boolean, host: EmitHost, resolver: EmitResolver, emitterDiagnostics: DiagnosticCollection) {
16771677
const emitDeclarationResult = emitDeclarations(host, resolver, emitterDiagnostics, declarationFilePath, sourceFiles, isBundledEmit);
1678-
const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath);
1678+
const emitSkipped = emitDeclarationResult.reportedDeclarationError || host.isEmitBlocked(declarationFilePath) || host.getCompilerOptions().noEmit;
16791679
if (!emitSkipped) {
16801680
const declarationOutput = emitDeclarationResult.referencePathsOutput
16811681
+ getDeclarationOutput(emitDeclarationResult.synchronousDeclarationOutput, emitDeclarationResult.moduleElementDeclarationEmitInfo);

src/compiler/emitter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7823,7 +7823,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, Promi
78237823
function emitFile({ jsFilePath, sourceMapFilePath, declarationFilePath}: { jsFilePath: string, sourceMapFilePath: string, declarationFilePath: string },
78247824
sourceFiles: SourceFile[], isBundledEmit: boolean) {
78257825
// Make sure not to write js File and source map file if any of them cannot be written
7826-
if (!host.isEmitBlocked(jsFilePath)) {
7826+
if (!host.isEmitBlocked(jsFilePath) && !compilerOptions.noEmit) {
78277827
emitJavaScript(jsFilePath, sourceMapFilePath, sourceFiles, isBundledEmit);
78287828
}
78297829
else {

src/harness/compilerRunner.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ class CompilerBaselineRunner extends RunnerBase {
142142

143143
it("Correct JS output for " + fileName, () => {
144144
if (hasNonDtsFiles && this.emit) {
145-
if (result.files.length === 0 && result.errors.length === 0) {
145+
if (!options.noEmit && result.files.length === 0 && result.errors.length === 0) {
146146
throw new Error("Expected at least one js file to be emitted or at least one error to be created.");
147147
}
148148

tests/baselines/reference/jsFileCompilationBindErrors.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)