Add a .d.ts file to the test to ensure it is excluded from the calculation too

This commit is contained in:
Andy Hanson 2016-11-03 12:28:19 -07:00
parent 2eca0af91b
commit 0b71df5099
4 changed files with 49 additions and 10 deletions

View File

@ -5,12 +5,21 @@
export const x = 0;
//// [bar.d.ts]
declare module "bar" {
export const y = 0;
}
//// [index.ts]
/// <reference path="../types/bar.d.ts"/>
import { x } from "foo";
x + 1;
import { y } from "bar";
x + y;
//// [/app/bin/index.js]
"use strict";
/// <reference path="../types/bar.d.ts"/>
var foo_1 = require("foo");
foo_1.x + 1;
var bar_1 = require("bar");
foo_1.x + bar_1.y;

View File

@ -1,9 +1,14 @@
=== /app/index.ts ===
/// <reference path="../types/bar.d.ts"/>
import { x } from "foo";
>x : Symbol(x, Decl(index.ts, 0, 8))
>x : Symbol(x, Decl(index.ts, 1, 8))
x + 1;
>x : Symbol(x, Decl(index.ts, 0, 8))
import { y } from "bar";
>y : Symbol(y, Decl(index.ts, 2, 8))
x + y;
>x : Symbol(x, Decl(index.ts, 1, 8))
>y : Symbol(y, Decl(index.ts, 2, 8))
=== /node_modules/foo/index.ts ===
// Test that importing a file from `node_modules` does not affect calculation of the common source directory.
@ -11,3 +16,9 @@ x + 1;
export const x = 0;
>x : Symbol(x, Decl(index.ts, 2, 12))
=== /types/bar.d.ts ===
declare module "bar" {
export const y = 0;
>y : Symbol(y, Decl(bar.d.ts, 1, 16))
}

View File

@ -1,11 +1,15 @@
=== /app/index.ts ===
/// <reference path="../types/bar.d.ts"/>
import { x } from "foo";
>x : 0
x + 1;
>x + 1 : number
import { y } from "bar";
>y : 0
x + y;
>x + y : number
>x : 0
>1 : 1
>y : 0
=== /node_modules/foo/index.ts ===
// Test that importing a file from `node_modules` does not affect calculation of the common source directory.
@ -14,3 +18,10 @@ export const x = 0;
>x : 0
>0 : 0
=== /types/bar.d.ts ===
declare module "bar" {
export const y = 0;
>y : 0
>0 : 0
}

View File

@ -6,13 +6,21 @@
// @filename: /node_modules/foo/index.ts
export const x = 0;
// @filename: /types/bar.d.ts
declare module "bar" {
export const y = 0;
}
// @filename: /app/index.ts
/// <reference path="../types/bar.d.ts"/>
import { x } from "foo";
x + 1;
import { y } from "bar";
x + y;
// @filename: /app/tsconfig.json
{
"compilerOptions": {
"outDir": "bin"
"outDir": "bin",
"typeRoots": ["../types"]
}
}