added tests

This commit is contained in:
Vladimir Matveev
2016-04-01 12:41:45 -07:00
parent aaaa9c0895
commit 12d90f3be9
92 changed files with 1250 additions and 263 deletions
@@ -2,16 +2,16 @@
//// [index.d.ts]
// We can find typings in the ./typings folder
// We can find typings in the ./types folder
declare var $: { foo(): void };
//// [consumer.ts]
/// <reference library="jquery" />
/// <reference types="jquery" />
$.foo();
//// [consumer.js]
/// <reference library="jquery" />
/// <reference types="jquery" />
$.foo();
@@ -1,13 +1,13 @@
=== tests/cases/conformance/references/consumer.ts ===
/// <reference library="jquery" />
=== /consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16))
>$ : Symbol($, Decl(index.d.ts, 3, 11))
>foo : Symbol(foo, Decl(index.d.ts, 3, 16))
=== tests/cases/conformance/references/typings/jquery/index.d.ts ===
=== /types/jquery/index.d.ts ===
// We can find typings in the ./typings folder
// We can find typings in the ./types folder
declare var $: { foo(): void };
>$ : Symbol($, Decl(index.d.ts, 3, 11))
@@ -0,0 +1,7 @@
[
"======== Resolving type reference directive 'jquery' from '/consumer.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"File '/types/jquery/package.json' does not exist.",
"File '/types/jquery/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/index.d.ts', primary: true. ========"
]
@@ -1,14 +1,14 @@
=== tests/cases/conformance/references/consumer.ts ===
/// <reference library="jquery" />
=== /consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo() : void
>$.foo : () => void
>$ : { foo(): void; }
>foo : () => void
=== tests/cases/conformance/references/typings/jquery/index.d.ts ===
=== /types/jquery/index.d.ts ===
// We can find typings in the ./typings folder
// We can find typings in the ./types folder
declare var $: { foo(): void };
>$ : { foo(): void; }
@@ -0,0 +1,22 @@
//// [tests/cases/conformance/references/library-reference-10.ts] ////
//// [package.json]
// package.json in a primary reference can refer to another file
{
"typings": "jquery.d.ts"
}
//// [jquery.d.ts]
declare var $: { foo(): void };
//// [consumer.ts]
/// <reference types="jquery" />
$.foo();
//// [consumer.js]
/// <reference types="jquery" />
$.foo();
@@ -0,0 +1,13 @@
=== /consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
=== /types/jquery/jquery.d.ts ===
declare var $: { foo(): void };
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
@@ -0,0 +1,8 @@
[
"======== Resolving type reference directive 'jquery' from '/consumer.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"Found 'package.json' at '/types/jquery/package.json'.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
"File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========"
]
@@ -0,0 +1,14 @@
=== /consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo() : void
>$.foo : () => void
>$ : { foo(): void; }
>foo : () => void
=== /types/jquery/jquery.d.ts ===
declare var $: { foo(): void };
>$ : { foo(): void; }
>foo : () => void
@@ -0,0 +1,22 @@
//// [tests/cases/conformance/references/library-reference-11.ts] ////
//// [package.json]
// package.json in a secondary reference can refer to another file
{
"typings": "jquery.d.ts"
}
//// [jquery.d.ts]
declare var $: { foo(): void };
//// [consumer.ts]
/// <reference types="jquery" />
$.foo();
//// [consumer.js]
/// <reference types="jquery" />
$.foo();
@@ -0,0 +1,13 @@
=== /a/b/consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
=== /a/node_modules/jquery/jquery.d.ts ===
declare var $: { foo(): void };
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
@@ -0,0 +1,29 @@
[
"======== Resolving type reference directive 'jquery' from '/a/b/consumer.ts' with compilation root dir '/a/b'. ========",
"Resolving with primary search path '/a/b/types/'",
"File '/a/b/types/jquery/package.json' does not exist.",
"File '/a/b/types/jquery/index.d.ts' does not exist.",
"Resolving with primary search path '/a/b/node_modules/'",
"File '/a/b/node_modules/jquery/package.json' does not exist.",
"File '/a/b/node_modules/jquery/index.d.ts' does not exist.",
"Resolving with primary search path '/a/b/node_modules/@types/'",
"File '/a/b/node_modules/@types/jquery/package.json' does not exist.",
"File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/a/b/node_modules/jquery.ts' does not exist.",
"File '/a/b/node_modules/jquery.d.ts' does not exist.",
"File '/a/b/node_modules/jquery/package.json' does not exist.",
"File '/a/b/node_modules/jquery/index.ts' does not exist.",
"File '/a/b/node_modules/jquery/index.d.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery.d.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery/package.json' does not exist.",
"File '/a/b/node_modules/@types/jquery/index.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.",
"File '/a/node_modules/jquery.ts' does not exist.",
"File '/a/node_modules/jquery.d.ts' does not exist.",
"Found 'package.json' at '/a/node_modules/jquery/package.json'.",
"'package.json' has 'typings' field 'jquery.d.ts' that references '/a/node_modules/jquery/jquery.d.ts'.",
"File '/a/node_modules/jquery/jquery.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/jquery.d.ts', primary: false. ========"
]
@@ -0,0 +1,14 @@
=== /a/b/consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo() : void
>$.foo : () => void
>$ : { foo(): void; }
>foo : () => void
=== /a/node_modules/jquery/jquery.d.ts ===
declare var $: { foo(): void };
>$ : { foo(): void; }
>foo : () => void
@@ -0,0 +1,22 @@
//// [tests/cases/conformance/references/library-reference-12.ts] ////
//// [package.json]
// package.json in a secondary reference can refer to another file
{
"types": "dist/jquery.d.ts"
}
//// [jquery.d.ts]
declare var $: { foo(): void };
//// [consumer.ts]
/// <reference types="jquery" />
$.foo();
//// [consumer.js]
/// <reference types="jquery" />
$.foo();
@@ -0,0 +1,13 @@
=== /a/b/consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
=== /a/node_modules/jquery/dist/jquery.d.ts ===
declare var $: { foo(): void };
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
@@ -0,0 +1,29 @@
[
"======== Resolving type reference directive 'jquery' from '/a/b/consumer.ts' with compilation root dir '/a/b'. ========",
"Resolving with primary search path '/a/b/types/'",
"File '/a/b/types/jquery/package.json' does not exist.",
"File '/a/b/types/jquery/index.d.ts' does not exist.",
"Resolving with primary search path '/a/b/node_modules/'",
"File '/a/b/node_modules/jquery/package.json' does not exist.",
"File '/a/b/node_modules/jquery/index.d.ts' does not exist.",
"Resolving with primary search path '/a/b/node_modules/@types/'",
"File '/a/b/node_modules/@types/jquery/package.json' does not exist.",
"File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/a/b/node_modules/jquery.ts' does not exist.",
"File '/a/b/node_modules/jquery.d.ts' does not exist.",
"File '/a/b/node_modules/jquery/package.json' does not exist.",
"File '/a/b/node_modules/jquery/index.ts' does not exist.",
"File '/a/b/node_modules/jquery/index.d.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery.d.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery/package.json' does not exist.",
"File '/a/b/node_modules/@types/jquery/index.ts' does not exist.",
"File '/a/b/node_modules/@types/jquery/index.d.ts' does not exist.",
"File '/a/node_modules/jquery.ts' does not exist.",
"File '/a/node_modules/jquery.d.ts' does not exist.",
"Found 'package.json' at '/a/node_modules/jquery/package.json'.",
"'package.json' has 'types' field 'dist/jquery.d.ts' that references '/a/node_modules/jquery/dist/jquery.d.ts'.",
"File '/a/node_modules/jquery/dist/jquery.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/a/node_modules/jquery/dist/jquery.d.ts', primary: false. ========"
]
@@ -0,0 +1,14 @@
=== /a/b/consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo() : void
>$.foo : () => void
>$ : { foo(): void; }
>foo : () => void
=== /a/node_modules/jquery/dist/jquery.d.ts ===
declare var $: { foo(): void };
>$ : { foo(): void; }
>foo : () => void
@@ -5,7 +5,7 @@
// package.json in a primary reference can refer to another file
{
"typings": "jquery.d.ts"
"types": "jquery.d.ts"
}
//// [jquery.d.ts]
@@ -13,10 +13,10 @@ declare var $: { foo(): void };
//// [consumer.ts]
/// <reference library="jquery" />
/// <reference types="jquery" />
$.foo();
//// [consumer.js]
/// <reference library="jquery" />
/// <reference types="jquery" />
$.foo();
@@ -1,11 +1,11 @@
=== tests/cases/conformance/references/consumer.ts ===
/// <reference library="jquery" />
=== /consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
=== tests/cases/conformance/references/typings/jquery/jquery.d.ts ===
=== /types/jquery/jquery.d.ts ===
declare var $: { foo(): void };
>$ : Symbol($, Decl(jquery.d.ts, 0, 11))
>foo : Symbol(foo, Decl(jquery.d.ts, 0, 16))
@@ -0,0 +1,8 @@
[
"======== Resolving type reference directive 'jquery' from '/consumer.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"Found 'package.json' at '/types/jquery/package.json'.",
"'package.json' has 'types' field 'jquery.d.ts' that references '/types/jquery/jquery.d.ts'.",
"File '/types/jquery/jquery.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/types/jquery/jquery.d.ts', primary: true. ========"
]
@@ -1,12 +1,12 @@
=== tests/cases/conformance/references/consumer.ts ===
/// <reference library="jquery" />
=== /consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo() : void
>$.foo : () => void
>$ : { foo(): void; }
>foo : () => void
=== tests/cases/conformance/references/typings/jquery/jquery.d.ts ===
=== /types/jquery/jquery.d.ts ===
declare var $: { foo(): void };
>$ : { foo(): void; }
>foo : () => void
@@ -7,10 +7,10 @@
declare var $: { foo(): void };
//// [consumer.ts]
/// <reference library="jquery" />
/// <reference types="jquery" />
$.foo();
//// [consumer.js]
/// <reference library="jquery" />
/// <reference types="jquery" />
$.foo();
@@ -1,11 +1,11 @@
=== tests/cases/conformance/references/src/consumer.ts ===
/// <reference library="jquery" />
=== /src/consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo : Symbol(foo, Decl(index.d.ts, 3, 16))
>$ : Symbol($, Decl(index.d.ts, 3, 11))
>foo : Symbol(foo, Decl(index.d.ts, 3, 16))
=== tests/cases/conformance/references/src/node_modules/jquery/index.d.ts ===
=== /src/node_modules/jquery/index.d.ts ===
// Secondary references are possible
@@ -0,0 +1,10 @@
[
"======== Resolving type reference directive 'jquery' from '/src/consumer.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/jquery/package.json' does not exist.",
"File '/src/types/jquery/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/jquery/package.json' does not exist.",
"File '/src/node_modules/jquery/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'jquery' was successfully resolved to '/src/node_modules/jquery/index.d.ts', primary: true. ========"
]
@@ -1,12 +1,12 @@
=== tests/cases/conformance/references/src/consumer.ts ===
/// <reference library="jquery" />
=== /src/consumer.ts ===
/// <reference types="jquery" />
$.foo();
>$.foo() : void
>$.foo : () => void
>$ : { foo(): void; }
>foo : () => void
=== tests/cases/conformance/references/src/node_modules/jquery/index.d.ts ===
=== /src/node_modules/jquery/index.d.ts ===
// Secondary references are possible
@@ -1,29 +0,0 @@
tests/cases/conformance/references/src/root.ts(1,1): error TS2304: Cannot find name 'foo'.
tests/cases/conformance/references/src/root.ts(2,1): error TS2304: Cannot find name 'bar'.
==== tests/cases/conformance/references/src/root.ts (2 errors) ====
/// <reference library="foo" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'foo'.
/// <reference library="bar" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'bar'.
==== tests/cases/conformance/references/node_modules/foo/index.d.ts (0 errors) ====
// Secondary references may be duplicated if they agree in content
/// <reference library="alpha" />
declare var foo: any;
==== tests/cases/conformance/references/node_modules/foo/node_modules/alpha/index.d.ts (0 errors) ====
declare var alpha: any;
==== tests/cases/conformance/references/node_modules/bar/index.d.ts (0 errors) ====
/// <reference library="alpha" />
declare var bar: any;
==== tests/cases/conformance/references/node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ====
declare var alpha: any;
@@ -4,24 +4,24 @@
// Secondary references may be duplicated if they agree in content
/// <reference library="alpha" />
/// <reference types="alpha" />
declare var foo: any;
//// [index.d.ts]
declare var alpha: any;
//// [index.d.ts]
/// <reference library="alpha" />
/// <reference types="alpha" />
declare var bar: any;
//// [index.d.ts]
declare var alpha: any;
//// [root.ts]
/// <reference library="foo" />
/// <reference library="bar" />
/// <reference types="foo" />
/// <reference types="bar" />
//// [root.js]
/// <reference library="foo" />
/// <reference library="bar" />
/// <reference types="foo" />
/// <reference types="bar" />
@@ -0,0 +1,21 @@
=== /src/root.ts ===
/// <reference types="foo" />
No type information for this code./// <reference types="bar" />
No type information for this code.
No type information for this code.=== /node_modules/foo/index.d.ts ===
// Secondary references may be duplicated if they agree in content
/// <reference types="alpha" />
declare var foo: any;
>foo : Symbol(foo, Decl(index.d.ts, 4, 11))
=== /node_modules/foo/node_modules/alpha/index.d.ts ===
declare var alpha: any;
>alpha : Symbol(alpha, Decl(index.d.ts, 0, 11))
=== /node_modules/bar/index.d.ts ===
/// <reference types="alpha" />
declare var bar: any;
>bar : Symbol(bar, Decl(index.d.ts, 1, 11))
@@ -0,0 +1,90 @@
[
"======== Resolving type reference directive 'foo' from '/src/root.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/foo/package.json' does not exist.",
"File '/src/types/foo/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/foo/package.json' does not exist.",
"File '/src/node_modules/foo/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/foo/package.json' does not exist.",
"File '/src/node_modules/@types/foo/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/src/node_modules/foo.ts' does not exist.",
"File '/src/node_modules/foo.d.ts' does not exist.",
"File '/src/node_modules/foo/package.json' does not exist.",
"File '/src/node_modules/foo/index.ts' does not exist.",
"File '/src/node_modules/foo/index.d.ts' does not exist.",
"File '/src/node_modules/@types/foo.ts' does not exist.",
"File '/src/node_modules/@types/foo.d.ts' does not exist.",
"File '/src/node_modules/@types/foo/package.json' does not exist.",
"File '/src/node_modules/@types/foo/index.ts' does not exist.",
"File '/src/node_modules/@types/foo/index.d.ts' does not exist.",
"File '/node_modules/foo.ts' does not exist.",
"File '/node_modules/foo.d.ts' does not exist.",
"File '/node_modules/foo/package.json' does not exist.",
"File '/node_modules/foo/index.ts' does not exist.",
"File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========",
"======== Resolving type reference directive 'bar' from '/src/root.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/bar/package.json' does not exist.",
"File '/src/types/bar/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/bar/package.json' does not exist.",
"File '/src/node_modules/bar/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/bar/package.json' does not exist.",
"File '/src/node_modules/@types/bar/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/src/node_modules/bar.ts' does not exist.",
"File '/src/node_modules/bar.d.ts' does not exist.",
"File '/src/node_modules/bar/package.json' does not exist.",
"File '/src/node_modules/bar/index.ts' does not exist.",
"File '/src/node_modules/bar/index.d.ts' does not exist.",
"File '/src/node_modules/@types/bar.ts' does not exist.",
"File '/src/node_modules/@types/bar.d.ts' does not exist.",
"File '/src/node_modules/@types/bar/package.json' does not exist.",
"File '/src/node_modules/@types/bar/index.ts' does not exist.",
"File '/src/node_modules/@types/bar/index.d.ts' does not exist.",
"File '/node_modules/bar.ts' does not exist.",
"File '/node_modules/bar.d.ts' does not exist.",
"File '/node_modules/bar/package.json' does not exist.",
"File '/node_modules/bar/index.ts' does not exist.",
"File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========",
"======== Resolving type reference directive 'alpha' from '/node_modules/foo/index.d.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/alpha/package.json' does not exist.",
"File '/src/types/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/alpha/package.json' does not exist.",
"File '/src/node_modules/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/alpha/package.json' does not exist.",
"File '/src/node_modules/@types/alpha/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/node_modules/foo/node_modules/alpha.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha/package.json' does not exist.",
"File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========",
"======== Resolving type reference directive 'alpha' from '/node_modules/bar/index.d.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/alpha/package.json' does not exist.",
"File '/src/types/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/alpha/package.json' does not exist.",
"File '/src/node_modules/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/alpha/package.json' does not exist.",
"File '/src/node_modules/@types/alpha/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/node_modules/bar/node_modules/alpha.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha/package.json' does not exist.",
"File '/node_modules/bar/node_modules/alpha/index.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========"
]
@@ -0,0 +1,21 @@
=== /src/root.ts ===
/// <reference types="foo" />
No type information for this code./// <reference types="bar" />
No type information for this code.
No type information for this code.=== /node_modules/foo/index.d.ts ===
// Secondary references may be duplicated if they agree in content
/// <reference types="alpha" />
declare var foo: any;
>foo : any
=== /node_modules/foo/node_modules/alpha/index.d.ts ===
declare var alpha: any;
>alpha : any
=== /node_modules/bar/index.d.ts ===
/// <reference types="alpha" />
declare var bar: any;
>bar : any
@@ -1,29 +1,26 @@
tests/cases/conformance/references/src/root.ts(1,1): error TS2304: Cannot find name 'foo'.
tests/cases/conformance/references/src/root.ts(2,1): error TS2304: Cannot find name 'bar'.
/node_modules/bar/index.d.ts(1,1): message TS4090: Conflicting library definitions for 'alpha' found at '/node_modules/bar/node_modules/alpha/index.d.ts' and '/node_modules/foo/node_modules/alpha/index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict.
==== tests/cases/conformance/references/src/root.ts (2 errors) ====
/// <reference library="foo" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'foo'.
/// <reference library="bar" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2304: Cannot find name 'bar'.
==== /src/root.ts (0 errors) ====
/// <reference types="foo" />
/// <reference types="bar" />
==== tests/cases/conformance/references/node_modules/foo/index.d.ts (0 errors) ====
==== /node_modules/foo/index.d.ts (0 errors) ====
// Secondary references may not be duplicated if they disagree in content
/// <reference library="alpha" />
/// <reference types="alpha" />
declare var foo: any;
==== tests/cases/conformance/references/node_modules/foo/node_modules/alpha/index.d.ts (0 errors) ====
==== /node_modules/foo/node_modules/alpha/index.d.ts (0 errors) ====
declare var alpha: any;
==== tests/cases/conformance/references/node_modules/bar/index.d.ts (0 errors) ====
/// <reference library="alpha" />
==== /node_modules/bar/index.d.ts (1 errors) ====
/// <reference types="alpha" />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! message TS4090: Conflicting library definitions for 'alpha' found at 'index.d.ts' and 'index.d.ts'. Copy the correct file to the 'typings' folder to resolve this conflict.
declare var bar: any;
==== tests/cases/conformance/references/node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ====
==== /node_modules/bar/node_modules/alpha/index.d.ts (0 errors) ====
declare var alpha: {};
@@ -4,24 +4,24 @@
// Secondary references may not be duplicated if they disagree in content
/// <reference library="alpha" />
/// <reference types="alpha" />
declare var foo: any;
//// [index.d.ts]
declare var alpha: any;
//// [index.d.ts]
/// <reference library="alpha" />
/// <reference types="alpha" />
declare var bar: any;
//// [index.d.ts]
declare var alpha: {};
//// [root.ts]
/// <reference library="foo" />
/// <reference library="bar" />
/// <reference types="foo" />
/// <reference types="bar" />
//// [root.js]
/// <reference library="foo" />
/// <reference library="bar" />
/// <reference types="foo" />
/// <reference types="bar" />
@@ -0,0 +1,90 @@
[
"======== Resolving type reference directive 'foo' from '/src/root.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/foo/package.json' does not exist.",
"File '/src/types/foo/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/foo/package.json' does not exist.",
"File '/src/node_modules/foo/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/foo/package.json' does not exist.",
"File '/src/node_modules/@types/foo/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/src/node_modules/foo.ts' does not exist.",
"File '/src/node_modules/foo.d.ts' does not exist.",
"File '/src/node_modules/foo/package.json' does not exist.",
"File '/src/node_modules/foo/index.ts' does not exist.",
"File '/src/node_modules/foo/index.d.ts' does not exist.",
"File '/src/node_modules/@types/foo.ts' does not exist.",
"File '/src/node_modules/@types/foo.d.ts' does not exist.",
"File '/src/node_modules/@types/foo/package.json' does not exist.",
"File '/src/node_modules/@types/foo/index.ts' does not exist.",
"File '/src/node_modules/@types/foo/index.d.ts' does not exist.",
"File '/node_modules/foo.ts' does not exist.",
"File '/node_modules/foo.d.ts' does not exist.",
"File '/node_modules/foo/package.json' does not exist.",
"File '/node_modules/foo/index.ts' does not exist.",
"File '/node_modules/foo/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'foo' was successfully resolved to '/node_modules/foo/index.d.ts', primary: false. ========",
"======== Resolving type reference directive 'bar' from '/src/root.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/bar/package.json' does not exist.",
"File '/src/types/bar/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/bar/package.json' does not exist.",
"File '/src/node_modules/bar/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/bar/package.json' does not exist.",
"File '/src/node_modules/@types/bar/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/src/node_modules/bar.ts' does not exist.",
"File '/src/node_modules/bar.d.ts' does not exist.",
"File '/src/node_modules/bar/package.json' does not exist.",
"File '/src/node_modules/bar/index.ts' does not exist.",
"File '/src/node_modules/bar/index.d.ts' does not exist.",
"File '/src/node_modules/@types/bar.ts' does not exist.",
"File '/src/node_modules/@types/bar.d.ts' does not exist.",
"File '/src/node_modules/@types/bar/package.json' does not exist.",
"File '/src/node_modules/@types/bar/index.ts' does not exist.",
"File '/src/node_modules/@types/bar/index.d.ts' does not exist.",
"File '/node_modules/bar.ts' does not exist.",
"File '/node_modules/bar.d.ts' does not exist.",
"File '/node_modules/bar/package.json' does not exist.",
"File '/node_modules/bar/index.ts' does not exist.",
"File '/node_modules/bar/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'bar' was successfully resolved to '/node_modules/bar/index.d.ts', primary: false. ========",
"======== Resolving type reference directive 'alpha' from '/node_modules/foo/index.d.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/alpha/package.json' does not exist.",
"File '/src/types/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/alpha/package.json' does not exist.",
"File '/src/node_modules/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/alpha/package.json' does not exist.",
"File '/src/node_modules/@types/alpha/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/node_modules/foo/node_modules/alpha.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha.d.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha/package.json' does not exist.",
"File '/node_modules/foo/node_modules/alpha/index.ts' does not exist.",
"File '/node_modules/foo/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/node_modules/foo/node_modules/alpha/index.d.ts', primary: false. ========",
"======== Resolving type reference directive 'alpha' from '/node_modules/bar/index.d.ts' with compilation root dir '/src'. ========",
"Resolving with primary search path '/src/types/'",
"File '/src/types/alpha/package.json' does not exist.",
"File '/src/types/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/'",
"File '/src/node_modules/alpha/package.json' does not exist.",
"File '/src/node_modules/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/src/node_modules/@types/'",
"File '/src/node_modules/@types/alpha/package.json' does not exist.",
"File '/src/node_modules/@types/alpha/index.d.ts' does not exist.",
"Resolving from node_modules folder...",
"File '/node_modules/bar/node_modules/alpha.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha.d.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha/package.json' does not exist.",
"File '/node_modules/bar/node_modules/alpha/index.ts' does not exist.",
"File '/node_modules/bar/node_modules/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/node_modules/bar/node_modules/alpha/index.d.ts', primary: false. ========"
]
@@ -7,10 +7,10 @@
declare var alpha: { a: string };
//// [foo.ts]
/// <reference library="alpha" />
/// <reference types="alpha" />
var x: string = alpha.a;
//// [foo.js]
/// <reference library="alpha" />
/// <reference types="alpha" />
var x = alpha.a;
@@ -1,12 +1,12 @@
=== tests/cases/conformance/references/src/foo.ts ===
/// <reference library="alpha" />
=== /src/foo.ts ===
/// <reference types="alpha" />
var x: string = alpha.a;
>x : Symbol(x, Decl(foo.ts, 1, 3))
>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20))
>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11))
>a : Symbol(a, Decl(index.d.ts, 3, 20))
=== tests/cases/conformance/references/typings/alpha/index.d.ts ===
=== /types/alpha/index.d.ts ===
// The primary lookup folder is relative to tsconfig.json, if present
@@ -0,0 +1,10 @@
[
"======== Resolving type reference directive 'alpha' from '/src/foo.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/'",
"File '/alpha/package.json' does not exist.",
"File '/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/types/'",
"File '/types/alpha/package.json' does not exist.",
"File '/types/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========"
]
@@ -1,12 +1,12 @@
=== tests/cases/conformance/references/src/foo.ts ===
/// <reference library="alpha" />
=== /src/foo.ts ===
/// <reference types="alpha" />
var x: string = alpha.a;
>x : string
>alpha.a : string
>alpha : { a: string; }
>a : string
=== tests/cases/conformance/references/typings/alpha/index.d.ts ===
=== /types/alpha/index.d.ts ===
// The primary lookup folder is relative to tsconfig.json, if present
@@ -7,10 +7,10 @@
declare var alpha: { a: string };
//// [foo.ts]
/// <reference library="alpha" />
/// <reference types="alpha" />
var x: string = alpha.a;
//// [foo.js]
/// <reference library="alpha" />
/// <reference types="alpha" />
var x = alpha.a;
@@ -1,12 +1,12 @@
=== tests/cases/conformance/references/base/src/foo.ts ===
/// <reference library="alpha" />
=== /base/src/foo.ts ===
/// <reference types="alpha" />
var x: string = alpha.a;
>x : Symbol(x, Decl(foo.ts, 1, 3))
>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20))
>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11))
>a : Symbol(a, Decl(index.d.ts, 3, 20))
=== tests/cases/conformance/references/base/typings/alpha/index.d.ts ===
=== /base/types/alpha/index.d.ts ===
// The primary lookup folder is relative to tsconfig.json's 'root', if present
@@ -0,0 +1,10 @@
[
"======== Resolving type reference directive 'alpha' from '/base/src/foo.ts' with compilation root dir '/base'. ========",
"Resolving with primary search path '/'",
"File '/alpha/package.json' does not exist.",
"File '/alpha/index.d.ts' does not exist.",
"Resolving with primary search path '/base/types/'",
"File '/base/types/alpha/package.json' does not exist.",
"File '/base/types/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/base/types/alpha/index.d.ts', primary: true. ========"
]
@@ -1,12 +1,12 @@
=== tests/cases/conformance/references/base/src/foo.ts ===
/// <reference library="alpha" />
=== /base/src/foo.ts ===
/// <reference types="alpha" />
var x: string = alpha.a;
>x : string
>alpha.a : string
>alpha : { a: string; }
>a : string
=== tests/cases/conformance/references/base/typings/alpha/index.d.ts ===
=== /base/types/alpha/index.d.ts ===
// The primary lookup folder is relative to tsconfig.json's 'root', if present
@@ -4,21 +4,21 @@
// Don't crash in circular library reference situations
/// <reference library="beta" />
/// <reference types="beta" />
declare var alpha: { a: string };
//// [index.d.ts]
/// <reference library="alpha" />
/// <reference types="alpha" />
declare var beta: { b: string };
//// [foo.ts]
/// <reference library="alpha" />
/// <reference library="beta" />
/// <reference types="alpha" />
/// <reference types="beta" />
var x: string = alpha.a + beta.b;
//// [foo.js]
/// <reference library="alpha" />
/// <reference library="beta" />
/// <reference types="alpha" />
/// <reference types="beta" />
var x = alpha.a + beta.b;
@@ -1,6 +1,6 @@
=== tests/cases/conformance/references/foo.ts ===
/// <reference library="alpha" />
/// <reference library="beta" />
=== /foo.ts ===
/// <reference types="alpha" />
/// <reference types="beta" />
var x: string = alpha.a + beta.b;
>x : Symbol(x, Decl(foo.ts, 2, 3))
>alpha.a : Symbol(a, Decl(index.d.ts, 4, 20))
@@ -11,17 +11,17 @@ var x: string = alpha.a + beta.b;
>b : Symbol(b, Decl(index.d.ts, 1, 19))
=== tests/cases/conformance/references/typings/alpha/index.d.ts ===
=== /types/alpha/index.d.ts ===
// Don't crash in circular library reference situations
/// <reference library="beta" />
/// <reference types="beta" />
declare var alpha: { a: string };
>alpha : Symbol(alpha, Decl(index.d.ts, 4, 11))
>a : Symbol(a, Decl(index.d.ts, 4, 20))
=== tests/cases/conformance/references/typings/beta/index.d.ts ===
/// <reference library="alpha" />
=== /types/beta/index.d.ts ===
/// <reference types="alpha" />
declare var beta: { b: string };
>beta : Symbol(beta, Decl(index.d.ts, 1, 11))
>b : Symbol(b, Decl(index.d.ts, 1, 19))
@@ -0,0 +1,22 @@
[
"======== Resolving type reference directive 'alpha' from '/foo.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"File '/types/alpha/package.json' does not exist.",
"File '/types/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========",
"======== Resolving type reference directive 'beta' from '/foo.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"File '/types/beta/package.json' does not exist.",
"File '/types/beta/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'beta' was successfully resolved to '/types/beta/index.d.ts', primary: true. ========",
"======== Resolving type reference directive 'beta' from '/types/alpha/index.d.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"File '/types/beta/package.json' does not exist.",
"File '/types/beta/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'beta' was successfully resolved to '/types/beta/index.d.ts', primary: true. ========",
"======== Resolving type reference directive 'alpha' from '/types/beta/index.d.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/types/'",
"File '/types/alpha/package.json' does not exist.",
"File '/types/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/types/alpha/index.d.ts', primary: true. ========"
]
@@ -1,6 +1,6 @@
=== tests/cases/conformance/references/foo.ts ===
/// <reference library="alpha" />
/// <reference library="beta" />
=== /foo.ts ===
/// <reference types="alpha" />
/// <reference types="beta" />
var x: string = alpha.a + beta.b;
>x : string
>alpha.a + beta.b : string
@@ -12,17 +12,17 @@ var x: string = alpha.a + beta.b;
>b : string
=== tests/cases/conformance/references/typings/alpha/index.d.ts ===
=== /types/alpha/index.d.ts ===
// Don't crash in circular library reference situations
/// <reference library="beta" />
/// <reference types="beta" />
declare var alpha: { a: string };
>alpha : { a: string; }
>a : string
=== tests/cases/conformance/references/typings/beta/index.d.ts ===
/// <reference library="alpha" />
=== /types/beta/index.d.ts ===
/// <reference types="alpha" />
declare var beta: { b: string };
>beta : { b: string; }
>b : string
@@ -0,0 +1,16 @@
//// [tests/cases/conformance/references/library-reference-9.ts] ////
//// [index.d.ts]
// Use types search path
declare var alpha: { a: string };
//// [foo.ts]
/// <reference types="alpha" />
var x: string = alpha.a;
//// [foo.js]
/// <reference types="alpha" />
var x = alpha.a;
@@ -0,0 +1,16 @@
=== /base/src/foo.ts ===
/// <reference types="alpha" />
var x: string = alpha.a;
>x : Symbol(x, Decl(foo.ts, 1, 3))
>alpha.a : Symbol(a, Decl(index.d.ts, 3, 20))
>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11))
>a : Symbol(a, Decl(index.d.ts, 3, 20))
=== /share/typelib/alpha/index.d.ts ===
// Use types search path
declare var alpha: { a: string };
>alpha : Symbol(alpha, Decl(index.d.ts, 3, 11))
>a : Symbol(a, Decl(index.d.ts, 3, 20))
@@ -0,0 +1,7 @@
[
"======== Resolving type reference directive 'alpha' from '/base/src/foo.ts' with compilation root dir '/'. ========",
"Resolving with primary search path '/share/typelib'",
"File '/share/typelib/alpha/package.json' does not exist.",
"File '/share/typelib/alpha/index.d.ts' exist - use it as a name resolution result.",
"======== Type reference directive 'alpha' was successfully resolved to '/share/typelib/alpha/index.d.ts', primary: true. ========"
]
@@ -0,0 +1,16 @@
=== /base/src/foo.ts ===
/// <reference types="alpha" />
var x: string = alpha.a;
>x : string
>alpha.a : string
>alpha : { a: string; }
>a : string
=== /share/typelib/alpha/index.d.ts ===
// Use types search path
declare var alpha: { a: string };
>alpha : { a: string; }
>a : string
@@ -3,11 +3,11 @@
"Explicitly specified module resolution kind: 'Classic'.",
"'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'",
"Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.",
"File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.",
"======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========",
"======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'Classic'.",
"File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.",
"======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========",
"======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'Classic'.",
@@ -19,6 +19,6 @@
"File 'c:/root/folder2/file4.d.ts' does not exist.",
"File 'c:/root/file4.ts' does not exist.",
"File 'c:/root/file4.d.ts' does not exist.",
"File 'c:/file4.ts' exist - use it as a module resolution result.",
"File 'c:/file4.ts' exist - use it as a name resolution result.",
"======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========"
]
@@ -4,12 +4,12 @@
"'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'",
"Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.",
"Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.",
"File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.",
"======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========",
"======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'NodeJs'.",
"Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.",
"File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.",
"======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========",
"======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'NodeJs'.",
@@ -31,6 +31,13 @@
"File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.",
"File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.",
"File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.",
"File 'c:/root/node_modules/file4.ts' does not exist.",
"File 'c:/root/node_modules/file4.tsx' does not exist.",
"File 'c:/root/node_modules/file4.d.ts' does not exist.",
@@ -38,12 +45,19 @@
"File 'c:/root/node_modules/file4/index.ts' does not exist.",
"File 'c:/root/node_modules/file4/index.tsx' does not exist.",
"File 'c:/root/node_modules/file4/index.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4.tsx' does not exist.",
"File 'c:/root/node_modules/@types/file4.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4/package.json' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.",
"File 'c:/node_modules/file4.ts' does not exist.",
"File 'c:/node_modules/file4.tsx' does not exist.",
"File 'c:/node_modules/file4.d.ts' does not exist.",
"File 'c:/node_modules/file4/package.json' does not exist.",
"File 'c:/node_modules/file4/index.ts' does not exist.",
"File 'c:/node_modules/file4/index.tsx' does not exist.",
"File 'c:/node_modules/file4/index.d.ts' exist - use it as a module resolution result.",
"File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.",
"======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========"
]
@@ -3,11 +3,11 @@
"Explicitly specified module resolution kind: 'Classic'.",
"'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'",
"Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.",
"File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.",
"======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========",
"======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'Classic'.",
"File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.",
"======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========",
"======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'Classic'.",
@@ -19,6 +19,6 @@
"File 'c:/root/folder2/file4.d.ts' does not exist.",
"File 'c:/root/file4.ts' does not exist.",
"File 'c:/root/file4.d.ts' does not exist.",
"File 'c:/file4.ts' exist - use it as a module resolution result.",
"File 'c:/file4.ts' exist - use it as a name resolution result.",
"======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========"
]
@@ -4,12 +4,12 @@
"'baseUrl' option is set to 'c:/root', using this value to resolve non-relative module name 'folder2/file2'",
"Resolving module name 'folder2/file2' relative to base url 'c:/root' - 'c:/root/folder2/file2'.",
"Loading module as file / folder, candidate module location 'c:/root/folder2/file2'.",
"File 'c:/root/folder2/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file2.ts' exist - use it as a name resolution result.",
"======== Module name 'folder2/file2' was successfully resolved to 'c:/root/folder2/file2.ts'. ========",
"======== Resolving module './file3' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'NodeJs'.",
"Loading module as file / folder, candidate module location 'c:/root/folder2/file3'.",
"File 'c:/root/folder2/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file3.ts' exist - use it as a name resolution result.",
"======== Module name './file3' was successfully resolved to 'c:/root/folder2/file3.ts'. ========",
"======== Resolving module 'file4' from 'c:/root/folder2/file2.ts'. ========",
"Explicitly specified module resolution kind: 'NodeJs'.",
@@ -31,6 +31,13 @@
"File 'c:/root/folder2/node_modules/file4/index.ts' does not exist.",
"File 'c:/root/folder2/node_modules/file4/index.tsx' does not exist.",
"File 'c:/root/folder2/node_modules/file4/index.d.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4.tsx' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4.d.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/package.json' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/index.ts' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/index.tsx' does not exist.",
"File 'c:/root/folder2/node_modules/@types/file4/index.d.ts' does not exist.",
"File 'c:/root/node_modules/file4.ts' does not exist.",
"File 'c:/root/node_modules/file4.tsx' does not exist.",
"File 'c:/root/node_modules/file4.d.ts' does not exist.",
@@ -38,12 +45,19 @@
"File 'c:/root/node_modules/file4/index.ts' does not exist.",
"File 'c:/root/node_modules/file4/index.tsx' does not exist.",
"File 'c:/root/node_modules/file4/index.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4.tsx' does not exist.",
"File 'c:/root/node_modules/@types/file4.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4/package.json' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.",
"File 'c:/node_modules/file4.ts' does not exist.",
"File 'c:/node_modules/file4.tsx' does not exist.",
"File 'c:/node_modules/file4.d.ts' does not exist.",
"File 'c:/node_modules/file4/package.json' does not exist.",
"File 'c:/node_modules/file4/index.ts' does not exist.",
"File 'c:/node_modules/file4/index.tsx' does not exist.",
"File 'c:/node_modules/file4/index.d.ts' exist - use it as a module resolution result.",
"File 'c:/node_modules/file4/index.d.ts' exist - use it as a name resolution result.",
"======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4/index.d.ts'. ========"
]
@@ -5,7 +5,7 @@
"'paths' option is specified, looking for a pattern to match module name 'folder2/file1'.",
"Module name 'folder2/file1', matched pattern '*'.",
"Trying substitution '*', candidate module location: 'folder2/file1'.",
"File 'c:/root/folder2/file1.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.",
"======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========",
"======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -16,7 +16,7 @@
"File 'c:/root/folder3/file2.ts' does not exist.",
"File 'c:/root/folder3/file2.d.ts' does not exist.",
"Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.",
"File 'c:/root/generated/folder3/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.",
"======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========",
"======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -24,7 +24,7 @@
"'paths' option is specified, looking for a pattern to match module name 'components/file3'.",
"Module name 'components/file3', matched pattern 'components/*'.",
"Trying substitution 'shared/components/*', candidate module location: 'shared/components/file3'.",
"File 'c:/root/shared/components/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/shared/components/file3.ts' exist - use it as a name resolution result.",
"======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3.ts'. ========",
"======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -41,6 +41,6 @@
"File 'c:/root/folder1/file4.d.ts' does not exist.",
"File 'c:/root/file4.ts' does not exist.",
"File 'c:/root/file4.d.ts' does not exist.",
"File 'c:/file4.ts' exist - use it as a module resolution result.",
"File 'c:/file4.ts' exist - use it as a name resolution result.",
"======== Module name 'file4' was successfully resolved to 'c:/file4.ts'. ========"
]
@@ -6,7 +6,7 @@
"Module name 'folder2/file1', matched pattern '*'.",
"Trying substitution '*', candidate module location: 'folder2/file1'.",
"Loading module as file / folder, candidate module location 'c:/root/folder2/file1'.",
"File 'c:/root/folder2/file1.ts' exist - use it as a module resolution result.",
"File 'c:/root/folder2/file1.ts' exist - use it as a name resolution result.",
"======== Module name 'folder2/file1' was successfully resolved to 'c:/root/folder2/file1.ts'. ========",
"======== Resolving module 'folder3/file2' from 'c:/root/folder1/file1.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -24,7 +24,7 @@
"File 'c:/root/folder3/file2/index.d.ts' does not exist.",
"Trying substitution 'generated/*', candidate module location: 'generated/folder3/file2'.",
"Loading module as file / folder, candidate module location 'c:/root/generated/folder3/file2'.",
"File 'c:/root/generated/folder3/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/folder3/file2.ts' exist - use it as a name resolution result.",
"======== Module name 'folder3/file2' was successfully resolved to 'c:/root/generated/folder3/file2.ts'. ========",
"======== Resolving module 'components/file3' from 'c:/root/folder1/file1.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -39,7 +39,7 @@
"File 'c:/root/shared/components/file3/package.json' does not exist.",
"File 'c:/root/shared/components/file3/index.ts' does not exist.",
"File 'c:/root/shared/components/file3/index.tsx' does not exist.",
"File 'c:/root/shared/components/file3/index.d.ts' exist - use it as a module resolution result.",
"File 'c:/root/shared/components/file3/index.d.ts' exist - use it as a name resolution result.",
"======== Module name 'components/file3' was successfully resolved to 'c:/root/shared/components/file3/index.d.ts'. ========",
"======== Resolving module 'file4' from 'c:/root/folder1/file1.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -72,6 +72,13 @@
"File 'c:/root/folder1/node_modules/file4/index.ts' does not exist.",
"File 'c:/root/folder1/node_modules/file4/index.tsx' does not exist.",
"File 'c:/root/folder1/node_modules/file4/index.d.ts' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4.ts' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4.tsx' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4.d.ts' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4/package.json' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4/index.ts' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4/index.tsx' does not exist.",
"File 'c:/root/folder1/node_modules/@types/file4/index.d.ts' does not exist.",
"File 'c:/root/node_modules/file4.ts' does not exist.",
"File 'c:/root/node_modules/file4.tsx' does not exist.",
"File 'c:/root/node_modules/file4.d.ts' does not exist.",
@@ -79,6 +86,13 @@
"File 'c:/root/node_modules/file4/index.ts' does not exist.",
"File 'c:/root/node_modules/file4/index.tsx' does not exist.",
"File 'c:/root/node_modules/file4/index.d.ts' does not exist.",
"File 'c:/node_modules/file4.ts' exist - use it as a module resolution result.",
"File 'c:/root/node_modules/@types/file4.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4.tsx' does not exist.",
"File 'c:/root/node_modules/@types/file4.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4/package.json' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.ts' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.tsx' does not exist.",
"File 'c:/root/node_modules/@types/file4/index.d.ts' does not exist.",
"File 'c:/node_modules/file4.ts' exist - use it as a name resolution result.",
"======== Module name 'file4' was successfully resolved to 'c:/node_modules/file4.ts'. ========"
]
@@ -10,7 +10,7 @@
"File 'c:/root/src/project/file3.d.ts' does not exist.",
"Trying other entries in 'rootDirs'",
"Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'",
"File 'c:/root/generated/src/project/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.",
"======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========",
"======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -24,6 +24,6 @@
"Trying other entries in 'rootDirs'",
"Loading 'file2' from the root dir 'c:/root/src', candidate location 'c:/root/src/file2'",
"File 'c:/root/src/file2.ts' does not exist.",
"File 'c:/root/src/file2.d.ts' exist - use it as a module resolution result.",
"File 'c:/root/src/file2.d.ts' exist - use it as a name resolution result.",
"======== Module name '../file2' was successfully resolved to 'c:/root/src/file2.d.ts'. ========"
]
@@ -17,7 +17,7 @@
"Trying other entries in 'rootDirs'",
"Loading 'project/file3' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file3'",
"Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file3'.",
"File 'c:/root/generated/src/project/file3.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/src/project/file3.ts' exist - use it as a name resolution result.",
"======== Module name './project/file3' was successfully resolved to 'c:/root/generated/src/project/file3.ts'. ========",
"======== Resolving module '../file2' from 'c:/root/generated/src/project/file3.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -43,6 +43,6 @@
"File 'c:/root/src/file2/package.json' does not exist.",
"File 'c:/root/src/file2/index.ts' does not exist.",
"File 'c:/root/src/file2/index.tsx' does not exist.",
"File 'c:/root/src/file2/index.d.ts' exist - use it as a module resolution result.",
"File 'c:/root/src/file2/index.d.ts' exist - use it as a name resolution result.",
"======== Module name '../file2' was successfully resolved to 'c:/root/src/file2/index.d.ts'. ========"
]
@@ -10,7 +10,7 @@
"File 'c:/root/src/project/file2.d.ts' does not exist.",
"Trying other entries in 'rootDirs'",
"Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'",
"File 'c:/root/generated/src/project/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.",
"======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========",
"======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -28,7 +28,7 @@
"File 'c:/root/module3.ts' does not exist.",
"File 'c:/root/module3.d.ts' does not exist.",
"File 'c:/module3.ts' does not exist.",
"File 'c:/module3.d.ts' exist - use it as a module resolution result.",
"File 'c:/module3.d.ts' exist - use it as a name resolution result.",
"======== Module name 'module3' was successfully resolved to 'c:/module3.d.ts'. ========",
"======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -40,7 +40,7 @@
"File 'c:/root/module1.d.ts' does not exist.",
"Trying substitution 'c:/shared/*', candidate module location: 'c:/shared/module1'.",
"File 'c:/shared/module1.ts' does not exist.",
"File 'c:/shared/module1.d.ts' exist - use it as a module resolution result.",
"File 'c:/shared/module1.d.ts' exist - use it as a name resolution result.",
"======== Module name 'module1' was successfully resolved to 'c:/shared/module1.d.ts'. ========",
"======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -48,7 +48,7 @@
"'paths' option is specified, looking for a pattern to match module name 'templates/module2'.",
"Module name 'templates/module2', matched pattern 'templates/*'.",
"Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.",
"File 'c:/root/generated/src/templates/module2.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.",
"======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========",
"======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========",
"Module resolution kind is not specified, using 'Classic'.",
@@ -62,6 +62,6 @@
"Trying other entries in 'rootDirs'",
"Loading 'file3' from the root dir 'c:/root/src', candidate location 'c:/root/src/file3'",
"File 'c:/root/src/file3.ts' does not exist.",
"File 'c:/root/src/file3.d.ts' exist - use it as a module resolution result.",
"File 'c:/root/src/file3.d.ts' exist - use it as a name resolution result.",
"======== Module name '../file3' was successfully resolved to 'c:/root/src/file3.d.ts'. ========"
]
@@ -17,7 +17,7 @@
"Trying other entries in 'rootDirs'",
"Loading 'project/file2' from the root dir 'c:/root/generated/src', candidate location 'c:/root/generated/src/project/file2'",
"Loading module as file / folder, candidate module location 'c:/root/generated/src/project/file2'.",
"File 'c:/root/generated/src/project/file2.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/src/project/file2.ts' exist - use it as a name resolution result.",
"======== Module name './project/file2' was successfully resolved to 'c:/root/generated/src/project/file2.ts'. ========",
"======== Resolving module 'module3' from 'c:/root/src/file1.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -50,6 +50,13 @@
"File 'c:/root/src/node_modules/module3/index.ts' does not exist.",
"File 'c:/root/src/node_modules/module3/index.tsx' does not exist.",
"File 'c:/root/src/node_modules/module3/index.d.ts' does not exist.",
"File 'c:/root/src/node_modules/@types/module3.ts' does not exist.",
"File 'c:/root/src/node_modules/@types/module3.tsx' does not exist.",
"File 'c:/root/src/node_modules/@types/module3.d.ts' does not exist.",
"File 'c:/root/src/node_modules/@types/module3/package.json' does not exist.",
"File 'c:/root/src/node_modules/@types/module3/index.ts' does not exist.",
"File 'c:/root/src/node_modules/@types/module3/index.tsx' does not exist.",
"File 'c:/root/src/node_modules/@types/module3/index.d.ts' does not exist.",
"File 'c:/root/node_modules/module3.ts' does not exist.",
"File 'c:/root/node_modules/module3.tsx' does not exist.",
"File 'c:/root/node_modules/module3.d.ts' does not exist.",
@@ -57,9 +64,16 @@
"File 'c:/root/node_modules/module3/index.ts' does not exist.",
"File 'c:/root/node_modules/module3/index.tsx' does not exist.",
"File 'c:/root/node_modules/module3/index.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/module3.ts' does not exist.",
"File 'c:/root/node_modules/@types/module3.tsx' does not exist.",
"File 'c:/root/node_modules/@types/module3.d.ts' does not exist.",
"File 'c:/root/node_modules/@types/module3/package.json' does not exist.",
"File 'c:/root/node_modules/@types/module3/index.ts' does not exist.",
"File 'c:/root/node_modules/@types/module3/index.tsx' does not exist.",
"File 'c:/root/node_modules/@types/module3/index.d.ts' does not exist.",
"File 'c:/node_modules/module3.ts' does not exist.",
"File 'c:/node_modules/module3.tsx' does not exist.",
"File 'c:/node_modules/module3.d.ts' exist - use it as a module resolution result.",
"File 'c:/node_modules/module3.d.ts' exist - use it as a name resolution result.",
"======== Module name 'module3' was successfully resolved to 'c:/node_modules/module3.d.ts'. ========",
"======== Resolving module 'module1' from 'c:/root/generated/src/project/file2.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -83,7 +97,7 @@
"File 'c:/shared/module1/package.json' does not exist.",
"File 'c:/shared/module1/index.ts' does not exist.",
"File 'c:/shared/module1/index.tsx' does not exist.",
"File 'c:/shared/module1/index.d.ts' exist - use it as a module resolution result.",
"File 'c:/shared/module1/index.d.ts' exist - use it as a name resolution result.",
"======== Module name 'module1' was successfully resolved to 'c:/shared/module1/index.d.ts'. ========",
"======== Resolving module 'templates/module2' from 'c:/root/generated/src/project/file2.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -92,7 +106,7 @@
"Module name 'templates/module2', matched pattern 'templates/*'.",
"Trying substitution 'generated/src/templates/*', candidate module location: 'generated/src/templates/module2'.",
"Loading module as file / folder, candidate module location 'c:/root/generated/src/templates/module2'.",
"File 'c:/root/generated/src/templates/module2.ts' exist - use it as a module resolution result.",
"File 'c:/root/generated/src/templates/module2.ts' exist - use it as a name resolution result.",
"======== Module name 'templates/module2' was successfully resolved to 'c:/root/generated/src/templates/module2.ts'. ========",
"======== Resolving module '../file3' from 'c:/root/generated/src/project/file2.ts'. ========",
"Module resolution kind is not specified, using 'NodeJs'.",
@@ -118,6 +132,6 @@
"File 'c:/root/src/file3/package.json' does not exist.",
"File 'c:/root/src/file3/index.ts' does not exist.",
"File 'c:/root/src/file3/index.tsx' does not exist.",
"File 'c:/root/src/file3/index.d.ts' exist - use it as a module resolution result.",
"File 'c:/root/src/file3/index.d.ts' exist - use it as a name resolution result.",
"======== Module name '../file3' was successfully resolved to 'c:/root/src/file3/index.d.ts'. ========"
]
@@ -1,5 +1,5 @@
// @module: amd
// @traceModuleResolution: true
// @traceResolution: true
// paths should error in the absence of baseurl
@@ -1,5 +1,5 @@
// @module: commonjs
// @traceModuleResolution: true
// @traceResolution: true
// paths should error in the absence of baseurl
// @filename: c:/root/tsconfig.json
@@ -1,5 +1,5 @@
// @module: amd
// @traceModuleResolution: true
// @traceResolution: true
// baseurl is defined in tsconfig.json
// paths has errors
@@ -1,5 +1,5 @@
// @module: commonjs
// @traceModuleResolution: true
// @traceResolution: true
// baseurl is defined in tsconfig.json
// paths has errors
@@ -1,7 +1,7 @@
// @moduleResolution: classic
// @module: amd
// @baseUrl: c:/root
// @traceModuleResolution: true
// @traceResolution: true
// baseUrl set via command line
@@ -1,7 +1,7 @@
// @moduleResolution: node
// @module: commonjs
// @baseUrl: c:/root
// @traceModuleResolution: true
// @traceResolution: true
// baseUrl set via command line
@@ -1,6 +1,6 @@
// @moduleResolution: classic
// @module: amd
// @traceModuleResolution: true
// @traceResolution: true
// baseUrl set via command line
@@ -1,6 +1,6 @@
// @moduleResolution: node
// @module: commonjs
// @traceModuleResolution: true
// @traceResolution: true
// baseUrl set via command line
@@ -1,5 +1,5 @@
// @module: amd
// @traceModuleResolution: true
// @traceResolution: true
// paths is defined in tsconfig.json
// @filename: c:/root/tsconfig.json
@@ -1,5 +1,5 @@
// @module: commonjs
// @traceModuleResolution: true
// @traceResolution: true
// paths is defined in tsconfig.json
// @filename: c:/root/tsconfig.json
@@ -1,5 +1,5 @@
// @module: amd
// @traceModuleResolution: true
// @traceResolution: true
// @filename: c:/root/src/tsconfig.json
{
@@ -1,5 +1,5 @@
// @module: commonjs
// @traceModuleResolution: true
// @traceResolution: true
// @filename: c:/root/src/tsconfig.json
{
@@ -1,5 +1,5 @@
// @module: amd
// @traceModuleResolution: true
// @traceResolution: true
// @filename: c:/root/src/tsconfig.json
{
@@ -1,5 +1,5 @@
// @module: commonjs
// @traceModuleResolution: true
// @traceResolution: true
// @filename: c:/root/src/tsconfig.json
{
@@ -1,11 +1,12 @@
// @noImplicitReferences: true
// @traceResolution: true
// We can find typings in the ./typings folder
// We can find typings in the ./types folder
// @filename: typings/jquery/index.d.ts
// @filename: /types/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: consumer.ts
/// <reference library="jquery" />
// @filename: /consumer.ts
/// <reference types="jquery" />
$.foo();
@@ -0,0 +1,17 @@
// @noImplicitReferences: true
// @traceResolution: true
// package.json in a primary reference can refer to another file
// @filename: /types/jquery/package.json
{
"typings": "jquery.d.ts"
}
// @filename: /types/jquery/jquery.d.ts
declare var $: { foo(): void };
// @filename: /consumer.ts
/// <reference types="jquery" />
$.foo();
@@ -0,0 +1,17 @@
// @noImplicitReferences: true
// @traceResolution: true
// package.json in a secondary reference can refer to another file
// @filename: /a/node_modules/jquery/package.json
{
"typings": "jquery.d.ts"
}
// @filename: /a/node_modules/jquery/jquery.d.ts
declare var $: { foo(): void };
// @filename: /a/b/consumer.ts
/// <reference types="jquery" />
$.foo();
@@ -0,0 +1,17 @@
// @noImplicitReferences: true
// @traceResolution: true
// package.json in a secondary reference can refer to another file
// @filename: /a/node_modules/jquery/package.json
{
"types": "dist/jquery.d.ts"
}
// @filename: /a/node_modules/jquery/dist/jquery.d.ts
declare var $: { foo(): void };
// @filename: /a/b/consumer.ts
/// <reference types="jquery" />
$.foo();
@@ -1,16 +1,17 @@
// @noImplicitReferences: true
// @traceResolution: true
// package.json in a primary reference can refer to another file
// @filename: typings/jquery/package.json
// @filename: /types/jquery/package.json
{
"typings": "jquery.d.ts"
"types": "jquery.d.ts"
}
// @filename: typings/jquery/jquery.d.ts
// @filename: /types/jquery/jquery.d.ts
declare var $: { foo(): void };
// @filename: consumer.ts
/// <reference library="jquery" />
// @filename: /consumer.ts
/// <reference types="jquery" />
$.foo();
@@ -1,10 +1,12 @@
// @noImplicitReferences: true
// @traceResolution: true
// @traceResolution: true
// Secondary references are possible
// @filename: src/node_modules/jquery/index.d.ts
// @filename: /src/node_modules/jquery/index.d.ts
declare var $: { foo(): void };
// @filename: src/consumer.ts
/// <reference library="jquery" />
// @filename: /src/consumer.ts
/// <reference types="jquery" />
$.foo();
@@ -1,21 +1,22 @@
// @noImplicitReferences: true
// @traceResolution: true
// Secondary references may be duplicated if they agree in content
// @filename: node_modules/foo/index.d.ts
/// <reference library="alpha" />
// @filename: /node_modules/foo/index.d.ts
/// <reference types="alpha" />
declare var foo: any;
// @filename: node_modules/foo/node_modules/alpha/index.d.ts
// @filename: /node_modules/foo/node_modules/alpha/index.d.ts
declare var alpha: any;
// @filename: node_modules/bar/index.d.ts
/// <reference library="alpha" />
// @filename: /node_modules/bar/index.d.ts
/// <reference types="alpha" />
declare var bar: any;
// @filename: node_modules/bar/node_modules/alpha/index.d.ts
// @filename: /node_modules/bar/node_modules/alpha/index.d.ts
declare var alpha: any;
// @filename: src/root.ts
/// <reference library="foo" />
/// <reference library="bar" />
// @filename: /src/root.ts
/// <reference types="foo" />
/// <reference types="bar" />
@@ -1,21 +1,22 @@
// @noImplicitReferences: true
// @traceResolution: true
// Secondary references may not be duplicated if they disagree in content
// @filename: node_modules/foo/index.d.ts
/// <reference library="alpha" />
// @filename: /node_modules/foo/index.d.ts
/// <reference types="alpha" />
declare var foo: any;
// @filename: node_modules/foo/node_modules/alpha/index.d.ts
// @filename: /node_modules/foo/node_modules/alpha/index.d.ts
declare var alpha: any;
// @filename: node_modules/bar/index.d.ts
/// <reference library="alpha" />
// @filename: /node_modules/bar/index.d.ts
/// <reference types="alpha" />
declare var bar: any;
// @filename: node_modules/bar/node_modules/alpha/index.d.ts
// @filename: /node_modules/bar/node_modules/alpha/index.d.ts
declare var alpha: {};
// @filename: src/root.ts
/// <reference library="foo" />
/// <reference library="bar" />
// @filename: /src/root.ts
/// <reference types="foo" />
/// <reference types="bar" />
@@ -1,14 +1,15 @@
// @noImplicitReferences: true
// @traceResolution: true
// The primary lookup folder is relative to tsconfig.json, if present
// @filename: typings/alpha/index.d.ts
// @filename: /types/alpha/index.d.ts
declare var alpha: { a: string };
// @filename: src/foo.ts
/// <reference library="alpha" />
// @filename: /src/foo.ts
/// <reference types="alpha" />
var x: string = alpha.a;
// @filename: tsconfig.json
// @filename: /tsconfig.json
{
}
@@ -1,17 +1,18 @@
// @noImplicitReferences: true
// @traceResolution: true
// The primary lookup folder is relative to tsconfig.json's 'root', if present
// @filename: base/typings/alpha/index.d.ts
// @filename: /base/types/alpha/index.d.ts
declare var alpha: { a: string };
// @filename: base/src/foo.ts
/// <reference library="alpha" />
// @filename: /base/src/foo.ts
/// <reference types="alpha" />
var x: string = alpha.a;
// @filename: tsconfig.json
// @filename: /tsconfig.json
{
"compilerOptions": {
"rootDir": "base"
}
"compilerOptions": {
"rootDir": "base"
}
}
@@ -1,17 +1,18 @@
// @noImplicitReferences: true
// @traceResolution: true
// Don't crash in circular library reference situations
// @filename: typings/alpha/index.d.ts
/// <reference library="beta" />
// @filename: /types/alpha/index.d.ts
/// <reference types="beta" />
declare var alpha: { a: string };
// @filename: typings/beta/index.d.ts
/// <reference library="alpha" />
// @filename: /types/beta/index.d.ts
/// <reference types="alpha" />
declare var beta: { b: string };
// @filename: foo.ts
/// <reference library="alpha" />
/// <reference library="beta" />
// @filename: /foo.ts
/// <reference types="alpha" />
/// <reference types="beta" />
var x: string = alpha.a + beta.b;
@@ -0,0 +1,20 @@
// @noImplicitReferences: true
// @traceResolution: true
// Use types search path
// @filename: /share/typelib/alpha/index.d.ts
declare var alpha: { a: string };
// @filename: /base/src/foo.ts
/// <reference types="alpha" />
var x: string = alpha.a;
// @filename: /tsconfig.json
{
"compilerOptions": {
"typesSearchPaths": [
"./share/typelib"
]
}
}
@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts"/>
// @Filename: src/types/lib/index.d.ts
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="lib/*1*/"/>
//// $.x;
goTo.marker("1");
goTo.definition();
verify.caretAtMarker("0");
@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts"/>
// @Filename: src/types/lib/index.d.ts
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="lib/*1*/"/>
//// $.x;
goTo.marker("1");
goTo.definition();
verify.caretAtMarker("0");
@@ -0,0 +1,12 @@
/// <reference path="fourslash.ts"/>
// @Filename: src/types/lib/index.d.ts
/////*0*/declare let $: {x: number};
// @Filename: src/app.ts
//// /// <reference types="lib/*1*/"/>
//// $.x;
goTo.marker("1");
goTo.definition();
verify.caretAtMarker("0");
+17 -15
View File
@@ -8,26 +8,28 @@ module ts {
assert.equal(actual, expected, "Encoded string using convertToBase64 does not match buffer.toString('base64')");
}
it("Converts ASCII charaters correctly", () => {
runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
});
if (Buffer) {
it("Converts ASCII charaters correctly", () => {
runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
});
it("Converts escape sequences correctly", () => {
runTest("\t\n\r\\\"\'\u0062");
});
it("Converts escape sequences correctly", () => {
runTest("\t\n\r\\\"\'\u0062");
});
it("Converts simple unicode characters correctly", () => {
runTest("ΠΣ ٵپ औठ ⺐⺠");
});
it("Converts simple unicode characters correctly", () => {
runTest("ΠΣ ٵپ औठ ⺐⺠");
});
it("Converts simple code snippet correctly", () => {
runTest(`/// <reference path="file.ts" />
it("Converts simple code snippet correctly", () => {
runTest(`/// <reference path="file.ts" />
var x: string = "string";
console.log(x);`);
});
});
it("Converts simple code snippet with unicode characters correctly", () => {
runTest(`var Π = 3.1415; console.log(Π);`);
});
it("Converts simple code snippet with unicode characters correctly", () => {
runTest(`var Π = 3.1415; console.log(Π);`);
});
}
});
}
+157 -1
View File
@@ -204,6 +204,13 @@ module ts {
"/a/b/c/d/node_modules/foo/index.ts",
"/a/b/c/d/node_modules/foo/index.tsx",
"/a/b/c/d/node_modules/foo/index.d.ts",
"/a/b/c/d/node_modules/@types/foo.ts",
"/a/b/c/d/node_modules/@types/foo.tsx",
"/a/b/c/d/node_modules/@types/foo.d.ts",
"/a/b/c/d/node_modules/@types/foo/package.json",
"/a/b/c/d/node_modules/@types/foo/index.ts",
"/a/b/c/d/node_modules/@types/foo/index.tsx",
"/a/b/c/d/node_modules/@types/foo/index.d.ts",
"/a/b/c/node_modules/foo.ts",
"/a/b/c/node_modules/foo.tsx",
"/a/b/c/node_modules/foo.d.ts",
@@ -211,6 +218,13 @@ module ts {
"/a/b/c/node_modules/foo/index.ts",
"/a/b/c/node_modules/foo/index.tsx",
"/a/b/c/node_modules/foo/index.d.ts",
"/a/b/c/node_modules/@types/foo.ts",
"/a/b/c/node_modules/@types/foo.tsx",
"/a/b/c/node_modules/@types/foo.d.ts",
"/a/b/c/node_modules/@types/foo/package.json",
"/a/b/c/node_modules/@types/foo/index.ts",
"/a/b/c/node_modules/@types/foo/index.tsx",
"/a/b/c/node_modules/@types/foo/index.d.ts",
])
}
});
@@ -246,6 +260,13 @@ module ts {
"/a/node_modules/b/c/node_modules/d/node_modules/foo/index.ts",
"/a/node_modules/b/c/node_modules/d/node_modules/foo/index.tsx",
"/a/node_modules/b/c/node_modules/d/node_modules/foo/index.d.ts",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.ts",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.tsx",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo.d.ts",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/package.json",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.ts",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.tsx",
"/a/node_modules/b/c/node_modules/d/node_modules/@types/foo/index.d.ts",
"/a/node_modules/b/c/node_modules/foo.ts",
"/a/node_modules/b/c/node_modules/foo.tsx",
"/a/node_modules/b/c/node_modules/foo.d.ts",
@@ -253,6 +274,13 @@ module ts {
"/a/node_modules/b/c/node_modules/foo/index.ts",
"/a/node_modules/b/c/node_modules/foo/index.tsx",
"/a/node_modules/b/c/node_modules/foo/index.d.ts",
"/a/node_modules/b/c/node_modules/@types/foo.ts",
"/a/node_modules/b/c/node_modules/@types/foo.tsx",
"/a/node_modules/b/c/node_modules/@types/foo.d.ts",
"/a/node_modules/b/c/node_modules/@types/foo/package.json",
"/a/node_modules/b/c/node_modules/@types/foo/index.ts",
"/a/node_modules/b/c/node_modules/@types/foo/index.tsx",
"/a/node_modules/b/c/node_modules/@types/foo/index.d.ts",
"/a/node_modules/b/node_modules/foo.ts",
"/a/node_modules/b/node_modules/foo.tsx",
"/a/node_modules/b/node_modules/foo.d.ts",
@@ -260,6 +288,13 @@ module ts {
"/a/node_modules/b/node_modules/foo/index.ts",
"/a/node_modules/b/node_modules/foo/index.tsx",
"/a/node_modules/b/node_modules/foo/index.d.ts",
"/a/node_modules/b/node_modules/@types/foo.ts",
"/a/node_modules/b/node_modules/@types/foo.tsx",
"/a/node_modules/b/node_modules/@types/foo.d.ts",
"/a/node_modules/b/node_modules/@types/foo/package.json",
"/a/node_modules/b/node_modules/@types/foo/index.ts",
"/a/node_modules/b/node_modules/@types/foo/index.tsx",
"/a/node_modules/b/node_modules/@types/foo/index.d.ts",
"/a/node_modules/foo.ts",
"/a/node_modules/foo.tsx",
"/a/node_modules/foo.d.ts",
@@ -267,7 +302,6 @@ module ts {
"/a/node_modules/foo/index.ts",
"/a/node_modules/foo/index.tsx"
]);
}
});
});
@@ -664,6 +698,13 @@ import b = require("./moduleB.ts");
"/root/folder1/node_modules/file6/index.ts",
"/root/folder1/node_modules/file6/index.tsx",
"/root/folder1/node_modules/file6/index.d.ts",
"/root/folder1/node_modules/@types/file6.ts",
"/root/folder1/node_modules/@types/file6.tsx",
"/root/folder1/node_modules/@types/file6.d.ts",
"/root/folder1/node_modules/@types/file6/package.json",
"/root/folder1/node_modules/@types/file6/index.ts",
"/root/folder1/node_modules/@types/file6/index.tsx",
"/root/folder1/node_modules/@types/file6/index.d.ts"
// success on /root/node_modules/file6.ts
]);
@@ -913,4 +954,119 @@ import b = require("./moduleB.ts");
assert(!result.resolvedModule);
});
});
describe("Type reference directive resolution: ", () => {
function test(compilationRoot: string, typeDirective: string, primary: boolean, initialFile: File, targetFile: File, ...otherFiles: File[]) {
const host = createModuleResolutionHost(false, ...[initialFile, targetFile].concat(...otherFiles));
const result = resolveTypeReferenceDirective(typeDirective, initialFile.name, compilationRoot, {}, host);
assert(result.resolvedTypeReferenceDirective.resolvedFileName !== undefined, "expected type directive to be resolved");
assert.equal(result.resolvedTypeReferenceDirective.resolvedFileName, targetFile.name, "unexpected result of type reference resolution");
assert.equal(result.resolvedTypeReferenceDirective.primary, primary, "unexpected 'primary' value");
}
it("Can be resolved from primary location", () => {
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/src/types/lib/index.d.ts" };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/src/types/lib/typings/lib.d.ts" };
const package = { name: "/root/src/types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/src/node_modules/lib/index.d.ts" };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/src/node_modules/lib/typings/lib.d.ts" };
const package = { name: "/root/src/node_modules/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/src/node_modules/@types/lib/index.d.ts" };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/src/node_modules/@types/lib/typings/lib.d.ts" };
const package = { name: "/root/src/node_modules/@types/lib/package.json", content: JSON.stringify({types: "typings/lib.d.ts"}) };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, package);
}
});
it("Can be resolved from secondary location", () => {
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/node_modules/lib.d.ts" };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/node_modules/lib/index.d.ts" };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/node_modules/lib/typings/lib.d.ts" };
const package = { name: "/root/node_modules/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2, package);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/node_modules/@types/lib/index.d.ts" };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2);
}
{
const f1 = { name: "/root/src/app.ts" }
const f2 = { name: "/root/node_modules/@types/lib/typings/lib.d.ts" };
const package = { name: "/root/node_modules/@types/lib/package.json", content: JSON.stringify({typings: "typings/lib.d.ts"}) };
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ false, f1, f2, package);
}
});
it("Primary resolution overrides secondary resolutions", () => {
{
const f1 = { name: "/root/src/a/b/c/app.ts" };
const f2 = { name: "/root/src/types/lib/index.d.ts" };
const f3 = { name: "/root/src/a/b/node_modules/lib.d.ts" }
test(/*libraryRoot*/"/root/src", /* typeDirective */"lib", /*primary*/ true, f1, f2, f3);
}
})
it("Reused program keeps errors", () => {
const f1 = { name: "/root/src/a/b/c/d/e/app.ts", content: `/// <reference types="lib"/>` };
const f2 = { name: "/root/src/a/b/c/d/node_modules/lib/index.d.ts", content: `declare var x: number;` };
const f3 = { name: "/root/src/a/b/c/d/f/g/app.ts", content: `/// <reference types="lib"/>` };
const f4 = { name: "/root/src/a/b/c/d/f/node_modules/lib/index.d.ts", content: `declare var x: number;` };
const files = [f1, f2, f3, f4];
const names = map(files, f => f.name);
const sourceFiles = arrayToMap(map(files, f => createSourceFile(f.name, f.content, ScriptTarget.ES6)), f => f.fileName);
const compilerHost: CompilerHost = {
fileExists : fileName => hasProperty(sourceFiles, fileName),
getSourceFile: fileName => sourceFiles[fileName],
getDefaultLibFileName: () => "lib.d.ts",
writeFile(file, text) {
throw new Error("NYI");
},
getCurrentDirectory: () => "/",
getCanonicalFileName: f => f.toLowerCase(),
getNewLine: () => "\r\n",
useCaseSensitiveFileNames: () => false,
readFile: fileName => hasProperty(sourceFiles, fileName) ? sourceFiles[fileName].text : undefined
};
const program1 = createProgram(names, {}, compilerHost);
const diagnostics1 = program1.getFileProcessingDiagnostics().getDiagnostics();
assert.equal(diagnostics1.length, 1, "expected one diagnostic");
const program2 = createProgram(names, {}, compilerHost, program1);
assert.isTrue(program1.structureIsReused);
const diagnostics2 = program1.getFileProcessingDiagnostics().getDiagnostics();
assert.equal(diagnostics2.length, 1, "expected one diagnostic");
assert.equal(diagnostics1[0].messageText, diagnostics2[0].messageText, "expected one diagnostic");
})
});
}
+109 -15
View File
@@ -118,13 +118,13 @@ module ts {
return "";
},
getCanonicalFileName(fileName): string {
return sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
return sys && sys.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
},
useCaseSensitiveFileNames(): boolean {
return sys.useCaseSensitiveFileNames;
return sys && sys.useCaseSensitiveFileNames;
},
getNewLine(): string {
return sys.newLine;
return sys ? sys.newLine : newLine;
},
fileExists: fileName => hasProperty(files, fileName),
readFile: fileName => {
@@ -160,36 +160,55 @@ module ts {
return size;
}
function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map<ResolvedModule>): void {
function checkResolvedModule(expected: ResolvedModule, actual: ResolvedModule): void {
assert.isTrue(actual !== undefined);
assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`);
assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'isExternalLibraryImport': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`);
}
function checkResolvedTypeDirective(expected: ResolvedTypeReferenceDirective, actual: ResolvedTypeReferenceDirective): void {
assert.isTrue(actual !== undefined);
assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`);
assert.isTrue(expected.primary === actual.primary, `'primary': expected '${expected.primary}' to be equal to '${actual.primary}'`);
}
function checkCache<T>(caption: string, program: Program, fileName: string, expectedContent: Map<T>, getCache: (f: SourceFile) => Map<T>, entryChecker: (expected: T, original:T) => void): void {
let file = program.getSourceFile(fileName);
assert.isTrue(file !== undefined, `cannot find file ${fileName}`);
const cache = getCache(file)
if (expectedContent === undefined) {
assert.isTrue(file.resolvedModules === undefined, "expected resolvedModules to be undefined");
assert.isTrue(cache === undefined, `expected ${caption} to be undefined`);
}
else {
assert.isTrue(file.resolvedModules !== undefined, "expected resolvedModuled to be set");
let actualCacheSize = getSizeOfMap(file.resolvedModules);
assert.isTrue(cache !== undefined, `expected ${caption} to be set`);
let actualCacheSize = getSizeOfMap(cache);
let expectedSize = getSizeOfMap(expectedContent);
assert.isTrue(actualCacheSize === expectedSize, `expected actual size: ${actualCacheSize} to be equal to ${expectedSize}`);
for (let id in expectedContent) {
if (hasProperty(expectedContent, id)) {
assert.isTrue(hasProperty(file.resolvedModules, id), `expected ${id} to be found in resolved modules`);
if (expectedContent[id]) {
const expected = expectedContent[id];
const actual = file.resolvedModules[id];
assert.isTrue(actual !== undefined);
assert.isTrue(expected.resolvedFileName === actual.resolvedFileName, `'resolvedFileName': expected '${expected.resolvedFileName}' to be equal to '${actual.resolvedFileName}'`);
assert.isTrue(expected.isExternalLibraryImport === actual.isExternalLibraryImport, `'shouldBeProperExternalModule': expected '${expected.isExternalLibraryImport}' to be equal to '${actual.isExternalLibraryImport}'`);
}
else {
assert.isTrue(file.resolvedModules[id] === undefined);
const actual = cache[id];
entryChecker(expected, actual);
}
}
else {
assert.isTrue(cache[id] === undefined);
}
}
}
}
function checkResolvedModulesCache(program: Program, fileName: string, expectedContent: Map<ResolvedModule>): void {
checkCache("resolved modules", program, fileName, expectedContent, f => f.resolvedModules, checkResolvedModule);
}
function checkResolvedTypeDirectivesCache(program: Program, fileName: string, expectedContent: Map<ResolvedTypeReferenceDirective>): void {
checkCache("resolved type directives", program, fileName, expectedContent, f => f.resolvedTypeReferenceDirectiveNames, checkResolvedTypeDirective);
}
describe("Reuse program structure", () => {
let target = ScriptTarget.Latest;
let files = [
@@ -197,9 +216,11 @@ module ts {
`
/// <reference path='b.ts'/>
/// <reference path='non-existing-file.ts'/>
/// <reference types="typerefs" />
`, "",`var x = 1`) },
{ name: "b.ts", text: SourceText.New(`/// <reference path='c.ts'/>`, "", `var y = 2`) },
{ name: "c.ts", text: SourceText.New("", "", `var z = 1;`) },
{ name: "types/typerefs/index.d.ts", text: SourceText.New("", "", `declare let z: number;`) },
]
it("successful if change does not affect imports", () => {
@@ -213,6 +234,17 @@ module ts {
assert.equal(program1Diagnostics.length, program2Diagnostics.length);
});
it("successful if change does not affect type reference directives", () => {
var program_1 = newProgram(files, ["a.ts"], { target });
var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
files[0].text = files[0].text.updateProgram("var x = 100");
});
assert.isTrue(program_1.structureIsReused);
let program1Diagnostics = program_1.getSemanticDiagnostics(program_1.getSourceFile("a.ts"))
let program2Diagnostics = program_2.getSemanticDiagnostics(program_1.getSourceFile("a.ts"))
assert.equal(program1Diagnostics.length, program2Diagnostics.length);
});
it("fails if change affects tripleslash references", () => {
var program_1 = newProgram(files, ["a.ts"], { target });
var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
@@ -232,11 +264,35 @@ module ts {
assert.isTrue(!program_1.structureIsReused);
});
it("fails if change affects type directives", () => {
var program_1 = newProgram(files, ["a.ts"], { target });
var program_2 = updateProgram(program_1, ["a.ts"], { target }, files => {
let newReferences = `
/// <reference path='b.ts'/>
/// <reference path='non-existing-file.ts'/>
/// <reference types="typerefs1" />`;
files[0].text = files[0].text.updateReferences(newReferences);
});
assert.isTrue(!program_1.structureIsReused);
});
it("fails if module kind changes", () => {
var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS });
var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.AMD }, files => void 0);
assert.isTrue(!program_1.structureIsReused);
});
it("fails if rootdir changes", () => {
var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/b" });
var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, rootDir: "/a/c" }, files => void 0);
assert.isTrue(!program_1.structureIsReused);
});
it("fails if config path changes", () => {
var program_1 = newProgram(files, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/b/tsconfig.json" });
var program_2 = updateProgram(program_1, ["a.ts"], { target, module: ModuleKind.CommonJS, configFilePath: "/a/c/tsconfig.json" }, files => void 0);
assert.isTrue(!program_1.structureIsReused);
});
it("resolution cache follows imports", () => {
let files = [
@@ -274,5 +330,43 @@ module ts {
assert.isTrue(!program_3.structureIsReused);
checkResolvedModulesCache(program_4, "a.ts", { "b": { resolvedFileName: "b.ts" }, "c": undefined });
});
it("resolved type directives cache follows type directives", () => {
let files = [
{ name: "a.ts", text: SourceText.New("/// <reference types='typedefs'/>", "", "var x = $") },
{ name: "types/typedefs/index.d.ts", text: SourceText.New("", "", "declare var $: number") },
];
var options: CompilerOptions = { target };
var program_1 = newProgram(files, ["a.ts"], options);
checkResolvedTypeDirectivesCache(program_1, "a.ts", { "typedefs": { resolvedFileName: "types/typedefs/index.d.ts", primary: true } });
checkResolvedTypeDirectivesCache(program_1, "types/typedefs/index.d.ts", undefined);
var program_2 = updateProgram(program_1, ["a.ts"], options, files => {
files[0].text = files[0].text.updateProgram("var x = 2");
});
assert.isTrue(program_1.structureIsReused);
// content of resolution cache should not change
checkResolvedTypeDirectivesCache(program_1, "a.ts", { "typedefs": { resolvedFileName: "types/typedefs/index.d.ts", primary: true } });
checkResolvedTypeDirectivesCache(program_1, "types/typedefs/index.d.ts", undefined);
// type reference directives has changed - program is not reused
var program_3 = updateProgram(program_2, ["a.ts"], options, files => {
files[0].text = files[0].text.updateReferences("");
});
assert.isTrue(!program_2.structureIsReused);
checkResolvedTypeDirectivesCache(program_3, "a.ts", undefined);
var program_4 = updateProgram(program_3, ["a.ts"], options, files => {
let newReferences = `/// <reference types="typedefs"/>
/// <reference types="typedefs2"/>
`;
files[0].text = files[0].text.updateReferences(newReferences);
});
assert.isTrue(!program_3.structureIsReused);
checkResolvedTypeDirectivesCache(program_1, "a.ts", { "typedefs": { resolvedFileName: "types/typedefs/index.d.ts", primary: true } });
});
})
}
@@ -9,18 +9,11 @@ describe('PreProcessFile:', function () {
function test(sourceText: string, readImportFile: boolean, detectJavaScriptImports: boolean, expectedPreProcess: ts.PreProcessedFileInfo): void {
var resultPreProcess = ts.preProcessFile(sourceText, readImportFile, detectJavaScriptImports);
var resultIsLibFile = resultPreProcess.isLibFile;
var resultImportedFiles = resultPreProcess.importedFiles;
var resultReferencedFiles = resultPreProcess.referencedFiles;
assert.equal(resultPreProcess.isLibFile, expectedPreProcess.isLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess.isLibFile + ". Actual: " + resultPreProcess.isLibFile);
var expectedIsLibFile = expectedPreProcess.isLibFile;
var expectedImportedFiles = expectedPreProcess.importedFiles;
var expectedReferencedFiles = expectedPreProcess.referencedFiles;
assert.equal(resultIsLibFile, expectedIsLibFile, "Pre-processed file has different value for isLibFile. Expected: " + expectedPreProcess + ". Actual: " + resultIsLibFile);
checkFileReferenceList("Imported files", expectedImportedFiles, resultImportedFiles);
checkFileReferenceList("Referenced files", expectedReferencedFiles, resultReferencedFiles);
checkFileReferenceList("Imported files", expectedPreProcess.importedFiles, resultPreProcess.importedFiles);
checkFileReferenceList("Referenced files", expectedPreProcess.referencedFiles, resultPreProcess.referencedFiles);
checkFileReferenceList("Type reference directives", expectedPreProcess.typeReferenceDirectives, resultPreProcess.typeReferenceDirectives);
assert.deepEqual(resultPreProcess.ambientExternalModules, expectedPreProcess.ambientExternalModules);
}
@@ -52,6 +45,7 @@ describe('PreProcessFile:', function () {
referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 37 }, { fileName: "refFile2.ts", pos: 38, end: 73 },
{ fileName: "refFile3.ts", pos: 74, end: 109 }, { fileName: "..\\refFile4d.ts", pos: 110, end: 150 }],
importedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
ambientExternalModules: undefined,
isLibFile: false
});
@@ -64,6 +58,7 @@ describe('PreProcessFile:', function () {
{
referencedFiles: <ts.FileReference[]>[],
importedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
ambientExternalModules: undefined,
isLibFile: false
});
@@ -75,6 +70,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
importedFiles: [{ fileName: "r1.ts", pos: 20, end: 25 }, { fileName: "r2.ts", pos: 49, end: 54 }, { fileName: "r3.ts", pos: 78, end: 83 },
{ fileName: "r4.ts", pos: 106, end: 111 }, { fileName: "r5.ts", pos: 138, end: 143 }],
ambientExternalModules: undefined,
@@ -88,6 +84,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
importedFiles: <ts.FileReference[]>[],
ambientExternalModules: undefined,
isLibFile: false
@@ -100,6 +97,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: <ts.FileReference[]>[],
typeReferenceDirectives: [],
importedFiles: [{ fileName: "r3.ts", pos: 73, end: 78 }],
ambientExternalModules: undefined,
isLibFile: false
@@ -112,6 +110,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }, { fileName: "refFile2.ts", pos: 36, end: 71 }],
typeReferenceDirectives: [],
importedFiles: [{ fileName: "r1.ts", pos: 92, end: 97 }, { fileName: "r2.ts", pos: 121, end: 126 }],
ambientExternalModules: undefined,
isLibFile: false
@@ -124,6 +123,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: [{ fileName: "refFile1.ts", pos: 0, end: 35 }],
typeReferenceDirectives: [],
importedFiles: [{ fileName: "r1.ts", pos: 91, end: 96 }, { fileName: "r3.ts", pos: 148, end: 153 }],
ambientExternalModules: undefined,
isLibFile: false
@@ -142,6 +142,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 20, end: 22 },
{ fileName: "m2", pos: 51, end: 53 },
@@ -165,6 +166,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 14, end: 16 },
{ fileName: "m2", pos: 36, end: 38 },
@@ -188,6 +190,7 @@ describe('PreProcessFile:', function () {
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [],
ambientExternalModules: ["B"],
isLibFile: false
@@ -200,6 +203,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 26, end: 28 }
],
@@ -218,6 +222,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ true,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ fileName: "m1", pos: 39, end: 41 },
{ fileName: "m2", pos: 74, end: 76 },
@@ -237,6 +242,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ true,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ fileName: "mod1", pos: 21, end: 25 },
{ fileName: "mod2", pos: 29, end: 33 },
@@ -254,6 +260,7 @@ describe('PreProcessFile:', function () {
/* detectJavaScriptImports */ true,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ fileName: "mod1", pos: 28, end: 32 },
{ fileName: "mod2", pos: 36, end: 40 },
@@ -274,6 +281,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "../Observable", "pos": 28, "end": 41 }
],
@@ -293,6 +301,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "m", "pos": 135, "end": 136 },
{ "fileName": "../Observable", "pos": 28, "end": 41 }
@@ -313,6 +322,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "m", "pos": 135, "end": 136 },
{ "fileName": "../Observable", "pos": 28, "end": 41 }
@@ -333,6 +343,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "../Observable", "pos": 28, "end": 41 }
],
@@ -352,6 +363,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "../Observable", "pos": 28, "end": 41 }
],
@@ -370,6 +382,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "../Observable", "pos": 28, "end": 41 }
],
@@ -390,6 +403,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "m2", "pos": 65, "end": 67 },
{ "fileName": "augmentation", "pos": 102, "end": 114 }
@@ -413,6 +427,7 @@ describe('PreProcessFile:', function () {
/*detectJavaScriptImports*/ false,
{
referencedFiles: [],
typeReferenceDirectives: [],
importedFiles: [
{ "fileName": "m2", "pos": 127, "end": 129 },
{ "fileName": "augmentation", "pos": 164, "end": 176 }
@@ -420,7 +435,30 @@ describe('PreProcessFile:', function () {
ambientExternalModules: ["m1"],
isLibFile: false
});
});
});
it ("correctly recognizes type reference directives", () => {
test(`
/// <reference path="a"/>
/// <reference types="a1"/>
/// <reference path="a2"/>
/// <reference types="a3"/>
`,
/*readImportFile*/ true,
/*detectJavaScriptImports*/ false,
{
referencedFiles: [
{ "pos": 13, "end": 38, "fileName": "a" },
{ "pos": 91, "end": 117, "fileName": "a2" }
],
typeReferenceDirectives: [
{ "pos": 51, "end": 78, "fileName": "a1" },
{ "pos": 130, "end": 157, "fileName": "a3" }
],
importedFiles: [],
ambientExternalModules: undefined,
isLibFile: false
});
})
});
});
+4 -4
View File
@@ -36,7 +36,7 @@ namespace ts.server {
let lastSent: protocol.Message;
beforeEach(() => {
session = new Session(mockHost, Buffer.byteLength, process.hrtime, mockLogger);
session = new Session(mockHost, Utils.byteLength, process.hrtime, mockLogger);
session.send = (msg: protocol.Message) => {
lastSent = msg;
};
@@ -161,7 +161,7 @@ namespace ts.server {
it("is an overrideable handle which sends protocol messages over the wire", () => {
const msg = {seq: 0, type: "none"};
const strmsg = JSON.stringify(msg);
const len = 1 + Buffer.byteLength(strmsg, "utf8");
const len = 1 + Utils.byteLength(strmsg, "utf8");
const resultMsg = `Content-Length: ${len}\r\n\r\n${strmsg}\n`;
session.send = Session.prototype.send;
@@ -253,7 +253,7 @@ namespace ts.server {
lastSent: protocol.Message;
customHandler = "testhandler";
constructor() {
super(mockHost, Buffer.byteLength, process.hrtime, mockLogger);
super(mockHost, Utils.byteLength, process.hrtime, mockLogger);
this.addProtocolHandler(this.customHandler, () => {
return {response: undefined, responseRequired: true};
});
@@ -311,7 +311,7 @@ namespace ts.server {
class InProcSession extends Session {
private queue: protocol.Request[] = [];
constructor(private client: InProcClient) {
super(mockHost, Buffer.byteLength, process.hrtime, mockLogger);
super(mockHost, Utils.byteLength, process.hrtime, mockLogger);
this.addProtocolHandler("echo", (req: protocol.Request) => ({
response: req.arguments,
responseRequired: true