Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixed harness to support packageDeclaration
  • Loading branch information
rbuckton committed May 8, 2015
commit 8a1c7c53452be478fc821ea2e7d953fe5280fabb
16 changes: 5 additions & 11 deletions src/harness/harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1173,17 +1173,11 @@ module Harness {
var declResult: Harness.Compiler.CompilerResult;
if (options.packageDeclaration) {
let file = ts.forEach(result.declFilesCode, declFile => declFile.fileName === options.packageDeclaration ? declFile : undefined);
declInputFiles.push({ unitName: file.fileName, content: file.code });
ts.forEach(inputFiles, file => {
if (isDTS(file.unitName)) {
declInputFiles.push(file);
}
});
ts.forEach(otherFiles, file => {
if (isDTS(file.unitName)) {
declOtherFiles.push(file);
}
});
if (file) {
declInputFiles.push({ unitName: file.fileName, content: file.code });
}
ts.forEach(inputFiles, file => isDTS(file.unitName) && declInputFiles.push(file));
ts.forEach(otherFiles, file => isDTS(file.unitName) && declOtherFiles.push(file));
}
else {
ts.forEach(inputFiles, file => addDtsFile(file, declInputFiles));
Expand Down
28 changes: 28 additions & 0 deletions tests/baselines/reference/packageDeclarationEmit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//// [tests/cases/compiler/packageDeclarationEmit.ts] ////

//// [index.ts]

export * from './ext';

//// [ext.ts]
export function func(): void {
}

//// [ext.js]
function func() {
}
exports.func = func;
//// [index.js]
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
}
__export(require('./ext'));


//// [app.d.ts]
declare module "app/tests/cases/compiler/ext" {
function func(): void;
}
declare module "app/tests/cases/compiler/index" {
export * from "app/tests/cases/compiler/ext";
}
8 changes: 8 additions & 0 deletions tests/baselines/reference/packageDeclarationEmit.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== tests/cases/compiler/index.ts ===

No type information for this code.export * from './ext';
No type information for this code.
No type information for this code.=== tests/cases/compiler/ext.ts ===
export function func(): void {
>func : Symbol(func, Decl(ext.ts, 0, 0))
}
8 changes: 8 additions & 0 deletions tests/baselines/reference/packageDeclarationEmit.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
=== tests/cases/compiler/index.ts ===

No type information for this code.export * from './ext';
No type information for this code.
No type information for this code.=== tests/cases/compiler/ext.ts ===
export function func(): void {
>func : () => void
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
error TS5047: Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.
error TS5047: Option 'separateCompilation' can only be used when either option 'module' is provided or option 'target' is 'ES6' or higher.


!!! error TS5047: Option 'separateCompilation' can only be used when either option'--module' is provided or option 'target' is 'ES6' or higher.
!!! error TS5047: Option 'separateCompilation' can only be used when either option 'module' is provided or option 'target' is 'ES6' or higher.
==== tests/cases/compiler/separateCompilationUnspecifiedModule.ts (0 errors) ====
export var x;