mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 01:33:15 -05:00
Verify that when emit blocking error occurs rest of the emit occurs as expected
This commit is contained in:
@@ -151,7 +151,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||
});
|
||||
|
||||
it("Correct JS output for " + fileName, () => {
|
||||
if (!ts.fileExtensionIs(lastUnit.name, "d.ts") && this.emit) {
|
||||
if (!(units.length === 1 && ts.fileExtensionIs(lastUnit.name, "d.ts")) && this.emit) {
|
||||
if (result.files.length === 0 && result.errors.length === 0) {
|
||||
throw new Error("Expected at least one js file to be emitted or at least one error to be created.");
|
||||
}
|
||||
|
||||
34
tests/baselines/reference/fileReferencesWithNoExtensions.js
Normal file
34
tests/baselines/reference/fileReferencesWithNoExtensions.js
Normal file
@@ -0,0 +1,34 @@
|
||||
//// [tests/cases/compiler/fileReferencesWithNoExtensions.ts] ////
|
||||
|
||||
//// [t.ts]
|
||||
/// <reference path="a"/>
|
||||
/// <reference path="b"/>
|
||||
/// <reference path="c"/>
|
||||
var a = aa; // Check that a.ts is referenced
|
||||
var b = bb; // Check that b.d.ts is referenced
|
||||
var c = cc; // Check that c.ts has precedence over c.d.ts
|
||||
|
||||
//// [a.ts]
|
||||
var aa = 1;
|
||||
|
||||
//// [b.d.ts]
|
||||
declare var bb: number;
|
||||
|
||||
//// [c.ts]
|
||||
var cc = 1;
|
||||
|
||||
//// [c.d.ts]
|
||||
declare var xx: number;
|
||||
|
||||
|
||||
//// [a.js]
|
||||
var aa = 1;
|
||||
//// [c.js]
|
||||
var cc = 1;
|
||||
//// [t.js]
|
||||
/// <reference path="a"/>
|
||||
/// <reference path="b"/>
|
||||
/// <reference path="c"/>
|
||||
var a = aa; // Check that a.ts is referenced
|
||||
var b = bb; // Check that b.d.ts is referenced
|
||||
var c = cc; // Check that c.ts has precedence over c.d.ts
|
||||
@@ -0,0 +1,17 @@
|
||||
error TS5055: Cannot write file 'tests/cases/compiler/a.js' which is one of the input files.
|
||||
|
||||
|
||||
!!! error TS5055: Cannot write file 'tests/cases/compiler/a.js' which is one of the input files.
|
||||
==== tests/cases/compiler/a.ts (0 errors) ====
|
||||
class c {
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/b.ts (0 errors) ====
|
||||
// this should be emitted
|
||||
class d {
|
||||
}
|
||||
|
||||
==== tests/cases/compiler/a.js (0 errors) ====
|
||||
function foo() {
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//// [tests/cases/compiler/jsFileCompilationEmitBlockedCorrectly.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
class c {
|
||||
}
|
||||
|
||||
//// [b.ts]
|
||||
// this should be emitted
|
||||
class d {
|
||||
}
|
||||
|
||||
//// [a.js]
|
||||
function foo() {
|
||||
}
|
||||
|
||||
|
||||
//// [b.js]
|
||||
// this should be emitted
|
||||
var d = (function () {
|
||||
function d() {
|
||||
}
|
||||
return d;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [tests/cases/compiler/jsFileCompilationWithDeclarationEmitPathSameAsInput.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
class c {
|
||||
}
|
||||
|
||||
//// [a.d.ts]
|
||||
declare function isC(): boolean;
|
||||
|
||||
//// [a.js]
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
@@ -0,0 +1,15 @@
|
||||
//// [tests/cases/compiler/jsFileCompilationWithOutDeclarationFileNameSameAsInputJsFile.ts] ////
|
||||
|
||||
//// [a.ts]
|
||||
class c {
|
||||
}
|
||||
|
||||
//// [b.d.ts]
|
||||
declare function foo(): boolean;
|
||||
|
||||
//// [b.js]
|
||||
var c = (function () {
|
||||
function c() {
|
||||
}
|
||||
return c;
|
||||
})();
|
||||
@@ -0,0 +1,13 @@
|
||||
// @jsExtensions: js
|
||||
// @filename: a.ts
|
||||
class c {
|
||||
}
|
||||
|
||||
// @filename: b.ts
|
||||
// this should be emitted
|
||||
class d {
|
||||
}
|
||||
|
||||
// @filename: a.js
|
||||
function foo() {
|
||||
}
|
||||
Reference in New Issue
Block a user