Skip to content
Merged
Prev Previous commit
Next Next commit
Add @CurrentDirectory into the test
  • Loading branch information
Kanchalai Tanglertsampan committed Jul 25, 2016
commit f949e0ebde728365c8e9897f540ee5097f0bb8db
4 changes: 2 additions & 2 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ namespace ts {
return resolutions;
}

function getInferredTypesRoot(options: CompilerOptions, rootFiles: string[], host: CompilerHost) {
function getInferredTypesRoot(options: CompilerOptions, rootFiles: string[], host: CompilerHost): string {
return computeCommonSourceDirectoryOfFilenames(rootFiles, host.getCurrentDirectory(), f => host.getCanonicalFileName(f));
}

Expand Down Expand Up @@ -1159,7 +1159,7 @@ namespace ts {

if (typeReferences) {
// This containgFilename needs to matched with the one used in managed-side
Copy link

@giannic giannic Jul 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: matched -> match and containgFilename -> containingFilename

const containingFilename = "__inferred type names__.ts"
const containingFilename = combinePaths(host.getCurrentDirectory(), "__inferred type names__.ts");
const resolutions = resolveTypeReferenceDirectiveNamesWorker(typeReferences, containingFilename);
for (let i = 0; i < typeReferences.length; i++) {
processTypeReferenceDirective(typeReferences[i], resolutions[i]);
Expand Down
2 changes: 1 addition & 1 deletion tests/cases/compiler/typeReferenceDirectives1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types

// @currentDirectory: /

// @filename: /types/lib/index.d.ts
interface $ { x }
Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives10.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /

// @filename: /ref.d.ts
export interface $ { x }
Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives11.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// @traceResolution: true
// @types: lib
// @out: output.js
// @currentDirectory: /

// @filename: /types/lib/index.d.ts

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives12.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @typeRoots: /types
// @traceResolution: true
// @out: output.js
// @currentDirectory: /

// @filename: /types/lib/index.d.ts

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives13.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /

// @filename: /ref.d.ts
export interface $ { x }
Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @declaration: true
// @typeRoots: /types
// @types: lib
// @currentDirectory: /

// @filename: /types/lib/index.d.ts
interface $ { x }
Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /

// $ comes from d.ts file - no need to add type reference directive

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /

// $ comes from d.ts file - no need to add type reference directive

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /

// @filename: /ref.d.ts
export interface $ { x }
Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /

// $ comes from type declaration file - type reference directive should be added

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives7.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @traceResolution: true
// @declaration: true
// @typeRoots: /types
// @currentDirectory: /

// local value shadows global - no need to add type reference directive

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives8.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// @typeRoots: /types
// @traceResolution: true
// @types: lib
// @currentDirectory: /

// @filename: /types/lib/index.d.ts

Expand Down
1 change: 1 addition & 0 deletions tests/cases/compiler/typeReferenceDirectives9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// @declaration: true
// @typeRoots: /types
// @traceResolution: true
// @currentDirectory: /

// @filename: /types/lib/index.d.ts

Expand Down
1 change: 1 addition & 0 deletions tests/cases/conformance/references/library-reference-13.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @noImplicitReferences: true
// @traceResolution: true
// @currentDirectory: /

// load type declarations from types section of tsconfig

Expand Down
1 change: 1 addition & 0 deletions tests/cases/conformance/typings/typingsLookup1.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// @traceResolution: true
// @noImplicitReferences: true
// @currentDirectory: /

// @filename: /tsconfig.json
{ "files": "a.ts" }
Expand Down